NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

1.0 HelloName

package Week_2;
import java.util.Scanner;
public class HelloName
{

public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Input your name: ");
String name = sc.nextLine();
System.out.println("Hello " + name);

}
}

2.0 FloatCalc


package Week_2;
import java.util.Scanner;

public class FloatCalc {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println("Enter 1st number");
float num1 = sc.nextFloat();
System.out.println("Enter 2nd number");
float num2 = sc.nextFloat();
float sum = num1+num2;
System.out.println("Their sum is "+ sum);
float diff = num1-num2;
System.out.println("Their difference is "+diff);
float prod = num1* num2;
System.out.println("Their product is "+prod);

}



}



3.0 MileKilo


package Week_2;
import java.util.Scanner;
public class MileKilo {

public static void main(String[] args)
{

Scanner sc = new Scanner(System.in);
System.out.print("Enter miles ");
double miles = sc.nextDouble();
double kilo = miles*1.60935;
System.out.print("The number of kilometer of the given mile is "+ kilo);

}
}




4.0 NameInitials


package Week_2;
import java.util.Scanner;
public class NameInitials {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println("Enter First name");
String fname = sc.next();
System.out.println("Enter last name");
String lname = sc.next();
char firstinitial= fname.charAt(0);
char lastinitial=lname.charAt(0);
System.out.println(fname+lname);
System.out.println(firstinitial+""+lastinitial);
}

}



5.0 TestScore


package Week_2;
import java.util.Scanner;

public class TestScore {
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
System.out.println("Enter first test score : ");
int test1 = sc.nextInt();
System.out.println("Enter second test score : ");
int test2 = sc.nextInt();
System.out.println("Enter third test score : ");
int test3 = sc.nextInt();
System.out.println("The score of 1st test is : "+test1);
System.out.println("The score of 2nd test is : "+test2);
System.out.println("The score of 3rd test is : "+test3);
int avg = (test1+test2+test3)/3;
System.out.println("The Average score of the test is : "+test3);

}

}

6.0 Program


package Week_2;

import java.util.Scanner;

public class Program {
public static void main(String []args){
Scanner sc = new Scanner(System.in);
System.out.println(" Enter numbers from 100 to 999: ");
int num = sc.nextInt();
int pro = 1;
while (num>0)
{
int rem = num%10;
pro = pro * rem;
num=num/10;

}
System.out.println("product is : "+pro);
}


}

     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.