Write a program in java to calculate average of five(5) numbers
import java.util.*;
class average
{
public static void main (String obj[ ])
{
int a, b, c , d, e,tot,avg;
Scanner sc=new scanner (system.in);
System.out.println(“Enter the value of a,b,c,d,e”);
a=sc nextInt ();
b=sc nextInt ();
c=sc nextInt ();
d=sc nextInt ();
e=sc nextInt ();
tot=a+b+c+d+e;
avg=tot/5;
system.out.println (“Average of 5 no is=”+avg);
}
}
class average
{
public static void main (String obj[ ])
{
int a, b, c , d, e,tot,avg;
Scanner sc=new scanner (system.in);
System.out.println(“Enter the value of a,b,c,d,e”);
a=sc nextInt ();
b=sc nextInt ();
c=sc nextInt ();
d=sc nextInt ();
e=sc nextInt ();
tot=a+b+c+d+e;
avg=tot/5;
system.out.println (“Average of 5 no is=”+avg);
}
}
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment