Write a program to calculate and display the sum of all the integers that are divisible by 6 but not divisible by 4 and lie between 0 and 100 . The program should also count and display the number of such value (use 'for' statement).
Please its urgent. Real answer please do not scam
Answers
Answered by
2
Answer:
public class sum
{
public static void main ()
{
int num = 0;
int sum = 0;
int x=0;
for (num=0;num<=100;num++)
{
if (num%6 == 0 && num%4 != 0)
{
sum+=num;
x+=1;
}
}
System.out.println("Sum of the values = "+sum);
System.out.println("Number of such values = "+x);
}
}
//written in Java
//please mark me as the brainliest
Similar questions