Write a program to display odd number from 1 to 50.
Answers
Answered by
5
Answer:
Exercises: Prints all even numbers between 1 and 50
Pictorial Presentation:
C Code: #include <stdio.h> int main() { int i; printf("Even numbers between 1 to 50 (inclusive):\n"); for (i = 1; i <= 50; i++) { if(i%2 == 0) { printf("%d ", i); } } return 0; } ...
Flowchart:
C Programming Code Editor: ...
Contribute your code and comments through Disqus.
Answered by
5
Hey Friend, Here is your answer!!
Step by step explanations:
public class Odd_numbers
{
public static void main (String args[ ] )
{
int a = 5;
System.out.println("Odd numbers from 1 to 50 :"+a) ;
for(int i = 1; i<=a; i++)
if(i%2!=0)
{
System.out.print(i+" ");
}
}
}
}
Hope you like my answer!!..
Similar questions