Activity 9 (MAT108.1-Zz)

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Noursalam A.

Riga
2nd year – BS Math

Activity 9
1.

/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
package activity.pkg9.mat108.pkg1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
*
* @author msu-wone
*/
public class Activity9MAT1081 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));

System.out.print("Enter a number:");
String input = reader.readLine();
int number = Integer.parseInt(input);

if(number==1)
System.out.println("One");
else if(number==2)
System.out.println("Two");
else if(number==3)
System.out.println("Three");
else if(number==4)
System.out.println("Four");
else if(number==5)
System.out.println("Five");
else if(number==6)
System.out.println("Six");
else if(number==7)
System.out.println("Seven");
else if(number==8)
System.out.println("Eight");
else if(number==9)
System.out.println("Nine");
else if(number==10)
System.out.println("Ten");
else if(10<=number)
System.out.println("Invalid Number");
}
}
Noursalam A. Riga
2nd year – BS Math

Output:

2.
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
package activity.pkg9.pkg2.mat108.pkg1;

/**
*
* @author msu-wone
*/
public class Activity92MAT1081 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int i = 0;
do
{
System.out.println("Math E. Matics");
i++;
}while(i<50);

}
Noursalam A. Riga
2nd year – BS Math

Output:

You might also like