Computer Science, asked by adarshkumar97, 1 year ago

Wap to input 3 numbers. If the product of their sum and average is divisible by the first number then print the sum of first two numbers else print the sum of last two numbers​

Answers

Answered by parthomsarwade
2

import java.util.*;

class p1

{

public static void main()

{

Scanner sc=new Scanner(System.in);

int a,b,c;

double s,avg,sum;

System.out.println("enter 3 numbers");

a=sc.nextInt();

b=sc.nextInt();

c=sc.nextInt();

s=a+b+c;

avg=(a+b+c)/3;

if(avg%a==0&&s%a==0)

{

sum=a+b;

}//if

else

{

sum=b+c;

}//else

}//void main

}//class

here a,b,c are 3 numbers

avg is the average

s is the sum of all digits

sum is the sum of other conditions


parthomsarwade: also remember one thing dont leave a single line one
adarshkumar97: ok
Similar questions