Tuesday, September 6, 2011

PROGRAM TO FIND AVERAGE

PROGRAM TO FIND AVERAGE

import java.util.*;
class Sam
{
public static void main(String args[])
{
float avg;
int n,sum=0;
Scanner s=new Scanner(System.in);

int i=0;

while(i<10)
{
n=s.nextInt();
sum=sum+n;
i++;
}

System.out.println(sum);
avg=sum/10;
System.out.println(avg);
}
}
If U LIKE THE POST FOLLOW THE BLOG

No comments:

Post a Comment