Java Practical 1

PHOTO EMBED

Mon Dec 12 2022 05:27:17 GMT+0000 (Coordinated Universal Time)

Saved by @codecoster #java

 {
		Scanner sc = new Scanner(System.in);

		System.out.println("Enter the number");

		int n = sc.nextInt();

		String num = String.valueOf(n);                              //Converting int to string type;
                      
		for(int i=0 ; i<num.length() ; i++)
 {
			switch(num.charAt(i))
   {                                                                    //checking the alphanumeric value for the digit
				case '0':
					System.out.print("zero ");
					break;
				case '1':
					System.out.print("one ");
					break;
				case '2':
					System.out.print("two ");
					break;
				case '3':
					System.out.print("three ");
					break;
				case '4':
					System.out.print("four ");
					break;
				case '5':
					System.out.print("five ");
					break;
				case '6':
					System.out.print("six ");
					break;
				case '7':
					System.out.print("seven ");
					break;
				case '8':
					System.out.print("eight ");
					break;
				case '9':
					System.out.print("nine ");
					break;
			}
		}
	}
}
content_copyCOPY

practical 1