WAP in C
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 😔
Member • Aug 30, 2014
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 😔
Member • Aug 30, 2014
Member • Aug 30, 2014
Member • Aug 31, 2014
Member • Aug 31, 2014
Member • Sep 1, 2014
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"<<f(i);
}
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.....
Member • Sep 1, 2014
Member • Sep 2, 2014
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? 👀😲