Program to addition of n number using Scanner class in java programming .

Program to addition of n number using Scanner class  in java programming :

import java.lang.*;
import java.io.*;
import java.util.*;
class AddnNumber
{
public static void main(String args[])
{
int num,value,i,sum=0;
Scanner s=new Scanner(System.in);
System.out.println("a3programming.blogspot.com");
System.out.println("Enter number howmany number do you want addition :\t");
num=s.nextInt();
System.out.println("Enter numbers :");
for(i=1; i<=num; i++)
{
value=s.nextInt();
sum=sum+value;

}
System.out.println("Result :"+sum);
}
}
Expected output is:


Post a Comment

2 Comments

  1. You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant! photo scanner reviews

    ReplyDelete
  2. Haunted 3D hai kya yha se nhi ho rhi

    ReplyDelete