Search This Blog

Loading...
If you have any problem or question please write in the comments. We will try to solve and send you the solution. Not just that we will also post your problems solution on our blog.

Wednesday, 19 October 2011

Java program to find sum, average and modulus by 3, of three numbers by(aol.com)

import java.util.*;
class average
{
public static void main (String args[])
{
Scanner in = new Scanner (System.in);
double a,b,c,sum=0;
double mod,avg;
System.out.print ("\n\t Enter first number = ");
a=in.nextDouble();
System.out.print ("\n\t Enter second number = ");
b=in.nextDouble();
System.out.print ("\n\t Enter third number = ");
c=in.nextDouble();
sum=a+b+c;
avg=sum/3;
mod=sum%3;




System.out.println ("\n\t Sum of the numbers = "+sum);
System.out.println ("\n\t Average of the numbers = "+avg);
System.out.println ("\n\t Modulus of the sum of numbers by 3 = "+mod);
}
}

No comments:

Post a Comment