wap a program using while loop to calculate the sum of first 10 even and odd integers.
(brainlyprogrammer, copythat, anindyaadhikari13)
Answers
Answered by
7
Answer:
//Solved in Java
class sum{
public static void main (String ar []){
int s=0,S1=0;
for(int I=1;I<=20;I++){
s+=(i%2==0)?I:0;
S1+=(i%2!=0)?I:0;
}
System.out.println("Sum of even="+s+"\nSum of Odd"+S1);
}
}
Similar questions
Computer Science,
2 hours ago
Math,
2 hours ago
English,
4 hours ago
English,
4 hours ago
Hindi,
7 months ago
World Languages,
7 months ago