/* Program to calculate average of 3 numbers */
class P1
{
public static void main(String args[])
{
int a, b, c, average;
a = 3;
b = 7;
c = 2 ;
average = ( a + b + c ) / 3;
System.out.println(" Average : "+average);
}
}
Subscribe to:
Post Comments (Atom)
5 comments:
Thank u very much Mr. Yogendra. This was helpful for me very much. Thumbz up. Keep posting type of small programme codes. It's a good help for beginners. Thanx again buddy. TC
I have a question.
what would happen if we write as
double avg=(a+b+c)/3.0;
i also want to know the same... divison is involved so why double will not come
thanku for help
thanku very much yogedra ধন্যবাদ
Post a Comment