WAP in C
5) write a program to print a histogram of fibonaci series of n item i.e if input is 7
then output will be
1, 1, 2, 3, 5, 8, 13
*
*
**
***
*****
********
*************
.
pliz solve it, if any 1 is here. i kno the algorithm bt its difficult to impliment 😔
then output will be
1, 1, 2, 3, 5, 8, 13
*
*
**
***
*****
********
*************
.
pliz solve it, if any 1 is here. i kno the algorithm bt its difficult to impliment 😔
Replies
-
simplycoder
Hello Vidhisha,Vidisha Singh5) write a program to print a histogram of fibonaci series of n item i.e if input is 7
then output will be
1, 1, 2, 3, 5, 8, 13
*
*
**
***
*****
********
*************
.
pliz solve it, if any 1 is here. i kno the algorithm bt its difficult to impliment 😔
The first program is called as printing the Fibonacci series for first n terms.
The second is very famous, loop pattern printing.
I suggest you to refer the tutorials here on this forum,
Beginners Tutorial : The C-language.
In case if you are stuck, please share your work and we would be glad to hlp you complete it.
Take care,
SC -
aviiwhat have you tried so far? post some code
-
Sanyam KhuranaPlease remember, People are not here to do your homework.
Best advice is, show us what you have done so far, or at least what you have tried, this way you'll learn more & solve your problem too.
Doesn't matter that if your program is not working, but at least show what you have tried yourself. -
jeshukb09Hi Vidisha...
I am here giving you just the main program part. Rest of the program and all has to be done by yourself.
The keywords which I am using here is related to C++.
variable 'f' is an array of N elements, where N is the number inputted by the user.
cout<<"The fibonocci series is : ");
for (i=1;i<=N;i++)
{
f(i)=1;
if (i>2)
f(i)=f(i-1)+f(i-2);
cout<<"\t"<}
for i=1;N<=N;i++
{
for j=1;j<=f(i);j++
cout<<"*";
cout<<"\n";
}
Actually the above given program is the logic. I have tried it in MATLAB programming and it is working. So I think it should work with this logic in C++. (Actually I have used C++ 6 years before. so I have some doubt in the syntax.) For reference I am giving below the actual program that I have done in MATLAB.
clear all
clc
N=input('Please enter the no.of number in the series : ');
f=zeros(1,N);
disp('The fibonocci series is : ');
for i=1:1:N
f(i)=1;
if i>2
f(i)=f(i-1)+f(i-2);
end
end
disp(f);
for i=1:1:N
for j=1:f(i)
fprintf('%s','*');
end
fprintf('\n');
end
Hope this will surely Help You..... -
avii^somebody please remove this. this will encourage more noobie behaviour
-
[Prototype]
Well done making the above 3 guys look idiot. You're the king man. That was such a tough one to solve. How could you even do it? 👀😲jeshukb09Hi Vidisha...
I am here giving you just the main program part. Rest of the program and all has to be done by yourself.
The keywords which I am using here is related to C++.
variable 'f' is an array of N elements, where N is the number inputted by the user.
cout<<"The fibonocci series is : ");
for (i=1;i<=N;i++)
{
f(i)=1;
if (i>2)
f(i)=f(i-1)+f(i-2);
cout<<"\t"<}
for i=1;N<=N;i++
{
for j=1;j<=f(i);j++
cout<<"*";
cout<<"\n";
}
Actually the above given program is the logic. I have tried it in MATLAB programming and it is working. So I think it should work with this logic in C++. (Actually I have used C++ 6 years before. so I have some doubt in the syntax.) For reference I am giving below the actual program that I have done in MATLAB.
clear all
clc
N=input('Please enter the no.of number in the series : ');
f=zeros(1,N);
disp('The fibonocci series is : ');
for i=1:1:N
f(i)=1;
if i>2
f(i)=f(i-1)+f(i-2);
end
end
disp(f);
for i=1:1:N
for j=1:f(i)
fprintf('%s','*');
end
fprintf('\n');
end
Hope this will surely Help You..... -
Sanyam KhuranaFirst let people show their own code. That way they'll learn even more. If they simply ask without trying, and you provide them with answers, they'll learn nothing, they'll simply have a mentality set that I'll just ask other people to do my homework.
You are thinking to help people here, and I really appreciate it. However, UN-intentionally you are doing more harm to them. Hope you understand, what we are actually trying to imply here. 😀 -
avii
Must some super haxx0r. may be Ankit Fadia.[Prototype]Well done making the above 3 guys look idiot. You're the king man. That was such a tough one to solve. How could you even do it? 👀😲
You are reading an archived discussion.
Related Posts
I just want to ask that when during os booting process only page files are made in the hard disk of the programs present,then if the virtual memory is made...
Quote:
It's been part of humanity's hygiene regimen for more than 4,000 years, but have you ever stopped to think what's actually in the stuff you're smearing across your teeth?...
OPPO Mobile India is here with the new iteration of their old smartphone by launching the OPPO Neo 3, a Dual SIM Android phone that's priced at Rs. 10,990. The...
Every party big or small requires music and if your budget is low, hiring a DJ to play the music isn’t an option. Keeping the budget conscious public in mind,...
XOLO India has come up with a new Android phone called the 'XOLO Play 8X-1100', the latest addition in the company's Play-series of smartphones targeted at gaming enthusiasts. Joining the...