write a program to display all odd number from 20 to 50 using do while loop
Attachments:
Answers
Answered by
0
Answer:
#include<stdio.h.
#include<conio.h>
void main()
{
int n,i=20;
printf("enter the number");
scanf("%d",&n);
do{
printf("%d odd numbers",i);
i=i+2;
}while(i<=n);
getch();
}
}
Explanation:
Answered by
0
Answer:
public class while_odd
{
public static void main(String args[])
{
int i=0;
System.out.println("Odd numbers from 20 to 50");
while(i<50)
{
i=i+1;
if(i%2!=0)
{
System.out.println(i);
}
}
}
}
Similar questions