Computer Science, asked by user975, 1 year ago

wap in Java to find out and display the average weight of a class assuming that there are 45 students in a class

Answers

Answered by Anonymous
2
import java.util.*
class avg
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int w, s=0, k;
for(k=0;k<=45;k++)
{
System.out.println("Enter the weight");
w=in.nextInt();
s=s+w;
}
double av = s/45;

System.out.println("Average weight ="av);
}
}
Similar questions