Program of Fibonacci Series in C++

#include<iostream>
using namespace std;
int main()
{
int x=0,y=1,z,i,t;
cout<<"enter any number\n";
cin>>z;
cout<<x<<endl;
for(i=2;i<z;i++)
{
t=x+y;
cout<<t<<endl;
y=x;
x=t;
}
getch();
}

No comments:

Post a Comment

programme for armstrong number for 3 digit in java

armstrong number import java.util.Scanner; class Mittu {     public static void main(String []args)     {         Scanner s=new Sca...