Skip to content

Commit 9e849f3

Browse files
committed
first commit
1 parent 54c0a34 commit 9e849f3

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

convert.java

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java.util.Scanner;
2+
3+
class convert {
4+
public static void main(String[] args){
5+
Scanner sc = new Scanner(System.in);
6+
int n = sc.nextInt();
7+
while(n --> 0){
8+
int m = sc.nextInt();
9+
int[] arr = new int[m];
10+
for(int i = 0 ; i < m ; i++){
11+
arr[i] = sc.nextInt();
12+
}
13+
14+
}
15+
}
16+
}

fibo_recu.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class fibo_recu{
66
static int n1=0,n2=1,n3=0;
77
static void printFeb(int count){
8-
if(count > 0){
8+
if(count >= 0){
99
n3 = n1 + n2;
1010
System.out.print(" "+n3);
1111
n1 = n2;
@@ -15,10 +15,11 @@ static void printFeb(int count){
1515
}
1616
public static void main(String args[]){
1717
Scanner sc = new Scanner(System.in);
18-
System.out.print("Enter the no you want to print: ");
1918
int count = sc.nextInt();
19+
System.out.print("Fibonacci series up to "+ count + "th term :" );
20+
// int count = sc.nextInt();
2021
sc.close();
21-
System.out.print("The Fibonacci is: "+n1 +" "+n2);
22+
System.out.print( n1 +" "+n2);
2223
printFeb(count - 2);
2324
}
2425
}

fibonacci.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ public static void main(String args[]){
88
int n1 = 0,n2 = 1,n3=0;
99
int count = sc.nextInt();
1010
sc.close();
11+
System.out.println("fibonacci series up to "+ count + "th term :");
1112
System.out.print(n1 +" "+n2);
12-
for(int i = 2; i < count; i++){
13+
for(int i = 2; i <= count; i++){
1314
n3 = n1+n2;
1415
System.out.print(" "+n3);
1516
n1 = n2;

patt.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public static void main(String[] args){
66
System.out.print(" ");
77
}
88
for(int j = i ; j <= n ; j++){
9-
System.out.print("* ");
9+
System.out.print("*");
1010
}
1111
System.out.println(" ");
1212
}
@@ -16,7 +16,7 @@ public static void main(String[] args){
1616
System.out.print(" ");
1717
}
1818
for(int j = 1; j <= i; j++){
19-
System.out.print("* ");
19+
System.out.print("*");
2020
}
2121
System.out.println(" ");
2222
}

0 commit comments

Comments
 (0)