#include<iostream>
int main()
{
int x=0, y=1;
std::cout<<x<<" ";
std::cout<<y<<" ";
while( y<1000000 )
{
std::cout<<(y+=x)<<" ";
x=y-x;
}
std::cout<<std::endl;
return(0);
}
#include
#include
main()
{
int n,i,c,a=0,b=1;
printf("Enter Fibonacci series of nth term : ");
scanf("%d",&n);
printf("%d %d ",a,b);
for(i=0;i<=(n-3);i++)
{
c=a+b;
a=b;
b=c;
printf("%d ",c);
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main ()
{
int x,y,z,i;
clrscr();
printf("Enter 1st Term: ");
scanf("%d",&x);
printf("Enter 2nd Term: ");
scanf("%d",&y);
printf("Series is: \n");
printf("%d ",x);
printf("%d ",y);
for(i=1;i<=23;i++)
{
z=x+y;
printf("%d ",z);
x=y;
y=z;
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a =1,b=0,c=0;
for(i=1;i<=n;i++)
{
printf("%d",c);
c=a+b;
a=b;
b=c;
getch();
}
I'm nearly 100% sure I'm doing your homework for you. If I am, then I really am disappointed. First of all, the name is "Fibonacci" and is detailed on wikipedia.
I'll just type it here and if it compiles, great, if not... I'm not going to do the whole assignment for you.
#include <stdio.h>
int main(int argc, char **argv)
{
int previousValueA = 0;
int previousValueB = 1;
int steps = 100;
int i;
int current;
printf("%d\n", previousValueA);
printf("%d\n", previousValueB);
for(i=0; i<steps; i++)
{
current = previousValueA + previousValueB;
previousValueA = previousValueB;
previousValueB = current;
printf("%d\n", current);
}
return 0;
}
#include void tribon(int n) { int a,b,c,d,i; b=1; c=0; d=0; i=1; while(i
#include <stdio.h>
unsigned long fib (unsigned long n) {
if (n 95, for 64 bit unsigned longs, due to integer overflow.
write a program to print the series 1/12+1/22+.........+1/n2 ?
You mean you have written a program, but you don't understand it? Well, how could I explain it without seeing it?
#include<stdio.h> #include<conio.h> void main() { }
c program was introduced in the year 1972 by Dennis RitchieNo, it was the C language, not the C program.
how to create a c program for left factoring.
find the program in c-pgms.blogspot.com
That would be the "fibonacci" series. It is the series of numbers:1 1 2 3 5 8 13 21...Where each number is the sum of the previous two.
Exactly what do you mean by 'C program in Java'
Please do.
write a program to print the series 1/12+1/22+.........+1/n2 ?
You mean you have written a program, but you don't understand it? Well, how could I explain it without seeing it?
#include<stdio.h> #include<conio.h> void main() { }
Reference:cprogramming-bd.com/c_page2.aspx# sum the series
i dn't know. haha
Yes, this can be done. For example for Fibonacci series. You will find plenty of examples if you google for the types of series you need to be generated.
the features of a C program
c program was introduced in the year 1972 by Dennis RitchieNo, it was the C language, not the C program.