/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cb_pr150;
import java.util.Scanner;
/**
* Fibonacci Series Generate
* @author Arif
**/
public class Cb_pr150 {
/**
* @param args the command line arguments
**/
public static void main(String[] args) {
// TODO code application logic here
System.out.println("Enter the maximum no. of terms");
Scanner ob=new Scanner(System.in);
int ch=ob.nextInt();
System.out.println("Fibonacci series: ");
int a,b,sum,n;
a=0;
b=1;
System.out.print(a + ", ");
System.out.print(b + ", ");
for(n=1;n<=ch;n++)
{
sum=a+b;
System.out.print("Term-"+n+": "+sum + ", ");
a=b;
b=sum;
}
}
}
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cb_pr150;
import java.util.Scanner;
/**
* Fibonacci Series Generate
* @author Arif
**/
public class Cb_pr150 {
/**
* @param args the command line arguments
**/
public static void main(String[] args) {
// TODO code application logic here
System.out.println("Enter the maximum no. of terms");
Scanner ob=new Scanner(System.in);
int ch=ob.nextInt();
System.out.println("Fibonacci series: ");
int a,b,sum,n;
a=0;
b=1;
System.out.print(a + ", ");
System.out.print(b + ", ");
for(n=1;n<=ch;n++)
{
sum=a+b;
System.out.print("Term-"+n+": "+sum + ", ");
a=b;
b=sum;
}
}
}
MCA colleges in noida
ReplyDeleteMSC IT colleges in noida
M TECH colleges in noida