- 2

Make this program 1+1+2+3+5............n

7th Oct 2020, 4:21 PM
adarsh Shukla
adarsh Shukla - avatar
5 Answers
+ 1
Excuse me sir I want it in java
8th Oct 2020, 1:47 AM
adarsh Shukla
adarsh Shukla - avatar
+ 1
Wich language ?
8th Oct 2020, 9:13 PM
Hicham
Hicham - avatar
0
import java.util.*; public class Program { public static void main(String[] args) { Scanner in = new Scanner (System .in); int i,a=1,b=1,s=0; int n= in.nextInt(); //n is the value of number of iritetion plz enter at the run time for(i=1;i<=n;i++){ s=a+b; a=b; b=s; } System .out .print (s-1); } }
8th Oct 2020, 2:39 AM
adarsh Shukla
adarsh Shukla - avatar
9th Oct 2020, 6:04 AM
narayanaprasad
narayanaprasad - avatar
0
Java
9th Oct 2020, 6:15 AM
adarsh Shukla
adarsh Shukla - avatar