IT practical file java
IT practical file java
number
package myproject;
E import java. util.Scanner ;
public class MyLoop {
public static void main (String[) args) {
Scanner user input new Scanner (System. in) ;
10 int x,R,i;
11 R=l;
12
System. out.println ("Enter a Number");
13 x = Integer.parseInt (user input. next () );
14 for (i=x;i>=l;i--)
R= R*i;
17
System. out.println ("Eactorial of "+ × + "is " R)
18
1
20
22
23
Activt
Java program to create calculator using
switch case
20 ne 1:Ry
Case
21 case 2 : R y l
22 case 3:R x*ybreak
23 caSe 4:R- x/yjbreak
24 defaul t:
29 System. out.printin ("Wrong Choice") zhreak:
26
Systen. out.println ("Re sult +R)#
20
29
Creating Class Object
Example
16 return 1b;
17
21
public class MyClass (
23 public static void main (String [] args) (
24 rectangle r = new reotangle () :
25 int A, P:
21 r.accept 0 7
A =r. area () :
28 P-r. perineter () i
20 System. out.println ("Area
30 System, out.println ("Perimeter= + P):
Java program to display multiples of 5
between 50 and 100
4 */
5 package myproject;
6 public class MyLoop
publi static void main (String [] args) {
8 int i;
9 i-50;
10 while (i<-100)
11
12 System. out.println (i) ;
13 i- i + 5;
14
15
16
Java program to display "Welcome" 10
times
Start PagexMyProject,java x
Source History e D
CTUK DLS/LDUUsL/aystemr LIeysLey epLees/ LcE
Click nbfs: //nbhost/SystemFile System/Templates/Clas
*/
package myproject;
E import java.util.Scanner;
public class MyProject
8
17
18
Java program to check no is even or odd
Source package
History myproject: BD
5
6 E import java.util.Scanner;
public class MyProject
Source History