Skip to content

Commit 50a9536

Browse files
authored
Add files via upload
1 parent 034e51b commit 50a9536

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

Fibonacci_Series.java

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java.util.Scanner;
2+
public class Fibonacci_Series {
3+
public static void main(String[] args) {
4+
int a = 0, b = 1;
5+
int c=0;
6+
System.out.println("Enter number : ");
7+
Scanner scan = new Scanner(System.in);
8+
int i =0;
9+
int x = scan.nextInt();
10+
11+
while (c<x) {
12+
System.out.println(c);
13+
c = a + b; a = b; b = c;
14+
}
15+
}
16+
}

Find_Number.java

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package Games;
2+
3+
import java.util.*;
4+
5+
public class Find_Number {
6+
public static void main(String[] args) {
7+
int randNo, inputNo, userAttempt = 1;
8+
Scanner scan = new Scanner(System.in);
9+
Random rand = new Random();
10+
randNo = rand.nextInt(101);
11+
System.out.println("Guess the number between 1 to 100\n");
12+
do {
13+
inputNo = scan.nextInt();
14+
if (inputNo > randNo) {
15+
System.out.println("Lower number!!");
16+
}
17+
if (inputNo < randNo) {
18+
System.out.println("Higher number!!");
19+
}
20+
if (inputNo == randNo) {
21+
System.out.println("Correct!!");
22+
System.out.println("You guessed in " + userAttempt + " attempts.");
23+
}
24+
userAttempt++;
25+
} while (inputNo != randNo);
26+
}
27+
}

Temperature_converter.java

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import java.util.Scanner;
2+
public class Temperature_converter {
3+
public static void main(String[] args) {
4+
Scanner scan = new Scanner(System.in);
5+
System.out.println("\n\tWelcome to Temperature Converter\n");
6+
System.out.print("Enter value which you want to convert : ");
7+
float value = scan.nextFloat();
8+
System.out.println(" Enter 1 for Celsius to Fahrenheit converter....");
9+
System.out.println(" Enter 2 for Fahrenheit to Celsius converter....");
10+
System.out.print("\nEnter your value here... ");
11+
int ans = scan.nextInt();
12+
if (ans == 1) {
13+
float value1 = (float) ((value*(1.8))+32);
14+
System.out.print("Your conversion is here.. "+value1+"°F");
15+
}
16+
if (ans == 2) {
17+
float value2 = (float) (value-32);
18+
float value3 = (float) (value2*(5)/9);
19+
System.out.print("Your conversion is here.. "+value3+"°C");
20+
}
21+
System.out.println("\n\tThank You!!..");
22+
}
23+
}

0 commit comments

Comments
 (0)