Write a program in Java to enter 10 numbers one by one and find. print the largest number entered and total of all the number
Answers
Answered by
2
Answer:
int max=0,s=0;
for(I=1;I<=10;I++)
{
System.out.println("Enter a no.");
n=Sc.nextInt();
s+=n; //finding sum
if (max<n) //check if max if less than number
max=n;
}
System.out.println ("Sum="+s);
System.out.println("Largest number"+max);
Similar questions
Political Science,
2 months ago
Physics,
2 months ago
Science,
6 months ago
History,
6 months ago
Biology,
10 months ago
Math,
10 months ago
Social Sciences,
10 months ago