Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@simplycoder-NsBEdD • Aug 30, 2014
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 πHello Vidhisha,
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,
<a href="https://www.crazyengineers.com/threads/beginners-tutorial-the-c-language.46520">Beginners Tutorial : The C-language.</a>
In case if you are stuck, please share your work and we would be glad to hlp you complete it.
Take care,
SC -
@avii-TGGs8o • Aug 30, 2014
what have you tried so far? post some code
-
@sanyam-Nl7Zqc • Aug 30, 2014
Please 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. -
@jeshukb09-d2BfWu • Aug 31, 2014
Hi 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..... -
@avii-TGGs8o • Aug 31, 2014
^somebody please remove this. this will encourage more noobie behaviour
-
@prototype-G9Gn5k • Sep 1, 2014
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.....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? ππ²
-
@sanyam-Nl7Zqc • Sep 1, 2014
First 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-TGGs8o • Sep 2, 2014
[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? ππ²
Must some super haxx0r. may be Ankit Fadia.