Code:
import java.util.Scanner;
class meansd
{
public static void main(String[] args)
{
int a,b,c;
double m,sd;
Scanner in=new Scanner(System.in);
System.out.println("Enter 3 numbers: ");
a=in.nextInt();
b=in.nextInt();
c=in.nextInt();
m=(a+b+c)/3;
sd=Math.sqrt(((a-m)*(a-m))+((b-m)*(b-m))+((c-m)*(c-m)))/3;
System.out.println("Mean= "+m);
System.out.println("SD= "+sd);
}
}
class meansd
{
public static void main(String[] args)
{
int a,b,c;
double m,sd;
Scanner in=new Scanner(System.in);
System.out.println("Enter 3 numbers: ");
a=in.nextInt();
b=in.nextInt();
c=in.nextInt();
m=(a+b+c)/3;
sd=Math.sqrt(((a-m)*(a-m))+((b-m)*(b-m))+((c-m)*(c-m)))/3;
System.out.println("Mean= "+m);
System.out.println("SD= "+sd);
}
}
No comments:
Post a Comment