Computer Science, asked by ooiuu, 11 months ago

Using scanner class, write a program to find and display the sum of any ten numbers entered by the user from the console.

Answers

Answered by Anonymous
5

// A sample program to display the sum of any 10 numbers

import java.util.Scanner;

public class SumToken

{

public static void main(String[]args)

{

Scanner in=new Scanner(System.in);

System.out.println("Enter any 10 numbers");

int i,n,s=0

     {

n=in.nextInt();

s=sn;

        }

}

}


siddhartharao77: In the given program : sn was not declared.
Anonymous: it is in scanner
Anonymous: so, it is not necessary
siddhartharao77: In the scanner u have written in not sn..
siddhartharao77: S=sn. Here sn is not initialized
ooiuu: helo user i have checked it
ooiuu: aand she is correct
ooiuu: i have run it
ooiuu: its okay according to the scanner
Anonymous: yes
Answered by shirisha1981
0

Answer:import java.util.Scanner;

public class SumToken

{

public static void main(String[]args)

{

Scanner in=new Scanner(System.in);

System.out.println("Enter any 10 numbers");

int i,n,s=0

    {

n=in.nextInt();

s=sn;

       }

}

}

Similar questions