Computer Science, asked by suhafimehnaz, 7 months ago

write a program to initialze a number and then display the number and its unit digit and the sum of number with its unit digit​

Answers

Answered by IamGenesis
1

Answer:

import java.util.Scanner;

class Abc{

static int n;

public static void main(String[] args){

Scanner sc = new Scanner(System.in);

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

n = sc.nextInt();

System.out.println("the number is " +n);

System.out.println("The unit digit is"+ (n%10));

System.out.println("The sum is"+ (n +(n%10)));

}

}

Similar questions