Computer Science, asked by mkaleemnfa, 9 months ago

write a program in java to find the sum of odd numbers 1 to 50​

Answers

Answered by Pragya3918red
4

Explanation:

class Calculation

{

void input ( )

{

int s = 0, i ;

for ( i = 1 ; i < = 50 ; i = i + 2)

{

while ( i/2 != 0)

{

s = s + i ;

}

}

System.out.println( " The sum of the numbers is " + s) ;

}

}

I HOPE THIS ANSWER WILL HELP YOU AND PLEASE MARK THIS ANSWER THE BRAINLIEST ONE...

Similar questions