Write a Java program that accepts an integer (n) and computes the value of n+nn+nnn
Write a Java program that accepts an integer (n) and computes the value of n+nn+nnn

Program

import java.util.Scanner;
public class Demo {
 public static void main(String[] args) {
 
  int num;  
  Scanner in = new Scanner(System.in);
  System.out.print("Input number: ");
  num = in .nextInt();
  System.out.printf("%d + %d%d  + %d%d%d\n", num, num, num, num, num, num);
 }
}

Output:

Input number: 123
123 + 123123 + 123123123

For latest job updates join Telegram Channel: https://t.me/sateeshm

Programs