1) wap to input a two digit number and print its sum of the digit. Please Someone In Normal way
Answers
Answered by
5
Answer:
assuming it is a Java programming....
import java.util.*;
class sum
{
public static void main (String ar[])
{
Scanner Sc=new Scanner (System.in);
System.out.println("Enter a number");
n=Sc.nextInt();
int s=0;
while (n!=0)
{
int d=n%10;
s+=d;
n/=10;
}
System.out.println("Sum="+s);
}
}
Plz mark my answer as brainliest if it is helpful
Similar questions
Geography,
3 months ago
English,
3 months ago
Computer Science,
7 months ago
Physics,
11 months ago
Math,
11 months ago
Political Science,
11 months ago