File tree Expand file tree Collapse file tree 8 files changed +83
-0
lines changed Expand file tree Collapse file tree 8 files changed +83
-0
lines changed Original file line number Diff line number Diff line change
1
+ import java .util .*;
2
+ public class BasicCalci {
3
+ public static void main (String args []) {
4
+ // Your Code Here
5
+ Scanner cin =new Scanner (System .in );
6
+
7
+ char ch ;
8
+ do {
9
+ ch =cin .next ().charAt (0 );
10
+ int a =cin .nextInt ();
11
+ int b =cin .nextInt ();
12
+ switch (ch ){
13
+ case '+' :
14
+ System .out .println (a +b );
15
+ break ;
16
+ case '-' :
17
+ System .out .println (a -b );
18
+ break ;
19
+ case '*' :
20
+ System .out .println (a *b );
21
+ break ;
22
+ case '/' :
23
+ System .out .println (a /b );
24
+ break ;
25
+ case '%' :
26
+ System .out .println (a +b );
27
+ break ;
28
+ default :
29
+ System .out .println ("Invalid operation. Try again." );
30
+ }
31
+ }while (ch !='X' ||ch !='x' );
32
+ }
33
+ }
34
+
Original file line number Diff line number Diff line change
1
+ import java .util .*;
2
+ public class Fahrenheit {
3
+ public static void main (String [] args ){
4
+ Scanner cin =new Scanner (System .in );
5
+ int min =cin .nextInt ();
6
+ int max =cin .nextInt ();
7
+ int interval =cin .nextInt ();
8
+ for (int i =min ;i <=max ;i +=interval ){
9
+ int c =(int )((5.0 /9.0 )*(i -32 ));
10
+ System .out .println (i +" " +c );
11
+ }
12
+ }
13
+ }
Original file line number Diff line number Diff line change
1
+ import java .util .Scanner ;
2
+ public class PrintSeries {
3
+ public static void main (String [] args ){
4
+ Scanner cin =new Scanner (System .in );
5
+ int n1 =cin .nextInt ();
6
+ int n2 =cin .nextInt ();
7
+ int i =1 ,count =1 ;
8
+ while (count <=n1 ){
9
+ int t =(3 *i )+2 ;
10
+ if (t %n2 ==0 ){
11
+ i ++;
12
+ continue ;
13
+ }else {
14
+ System .out .println (t );
15
+ count ++;
16
+ }
17
+ i ++;
18
+ }
19
+ }
20
+ }
Original file line number Diff line number Diff line change
1
+ import java .util .*;
2
+ public class StringSort {
3
+ public static void main (String args []) {
4
+ Scanner cin =new Scanner (System .in );
5
+ int n =cin .nextInt ();
6
+ ArrayList <String > list =new ArrayList <>();
7
+ for (int i =0 ;i <=n ;i ++){
8
+ String s =cin .nextLine ();
9
+ list .add (s );
10
+ }
11
+ Collections .sort (list );
12
+ for (String s :list ){
13
+ System .out .println (s );
14
+ }
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments