write a program (keep taking numbers as input from user until user enters an Odd number)

 //keep taking numbers as input from user until user enters an Odd number

#include<stdio.h>

int main()

{

int n;

do{
printf("enter any number=");
scanf("%d", &n);
printf("%d\n", n);
if(n % 2 !=0){
break;
}
}
while(1);

printf("you have entered an odd number ");
return 0;
}

output :
enter any number=0
0
enter any number=8
8
enter any number=6
6
enter any number=4
4
enter any number=2
2
enter any number=3
3
you have entered an odd number
--------------------------------
Process exited after 11.81 seconds with return value 0
Press any key to continue . . .

Comments

Popular posts from this blog

Write a program to check if a number is prime or not.

Write a program to print the grades to a student.