0% found this document useful (0 votes)
29 views2 pages

Practice 4

Uploaded by

samyak jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Practice 4

Uploaded by

samyak jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import java.util.

Scanner;

public class main {

public static void main (String[] args) {

System.out.println("Hello World");
Scanner sc = new Scanner(System.in);

}
}

----------------------------------------------------|

import java.util.Scanner;

public class Main{


public static void main (String [] args){
Scanner sc = new Scanner(System.in);

System.out.print("Enter 1st number : ");


int a = sc.nextInt();
System.out.print("\nEnter 2nd number : ");
int b = sc.nextInt();
System.out.print("\nEnter 3rd number : ");
int c = sc.nextInt();

System.out.println("Sum of integers is : " +(a+b+c));

}
}

----------------------------------------------------|

import java.util.Scanner;

public class Main{


public static void main (String [] args){
Scanner sc = new Scanner(System.in);

System.out.print("Enter Marks of Maths : ");


int maths = sc.nextInt();
System.out.print("\n Enter Marks of Science : ");
int science =sc.nextInt();
System.out.print("\n Enter Marks of English : ");
int english = sc.nextInt();

System.out.println("Your GPA is : " + ((science+maths+english)/300));


}
}

----------------------------------------------------|

import java.util.Scanner;

public class Main{


public static void main(String[] args){
Scanner sc = new Scanner(System.in);

System.out.print("Enter Your Name :");


String a = sc.next();

System.out.println("\nHello "+a+" have a good day");


}
}

----------------------------------------------------|

import java.util.Scanner;

public class Main{


public static void main(String[] args){
Scanner sc = new Scanner(System.in);

System.out.print("Enter Distance in kms :");


Double a = sc.nextDouble();

System.out.println("\nHello "+a+"kms in miles is "+(a * 0.621371 )


+"miles");
}
}

----------------------------------------------------|

You might also like