0
Write a program to print all the odd numbers from 50 to 120 only by using C programming.
4 ответов
+ 2
Just a little suggestion:
Use a for loop where i starts from 50 and ends in 120 .Then give a if statement to find the odd number from i and print it.
+ 2
for(i=50;i<=120;i++)
{
if(i%2==1)
printf("%d",i);
}
+ 1
Pls show us your attempt! We will help you if you have any bugs in your code😊😊
+ 1
The main part of this can be done minimally by two statements: a for() loop statement and a printf() statement. Have the for() loop initialize its integer loop counter to the first odd number in the range: 51. Define a loop condition that tests for the counter being less than 120. Add an update expression that increments the loop counter by 2. That will make the loop counter skip even numbers and hold odd numbers only. Inside the loop place a printf() statement that prints the loop counter's integer value.