4.(C) Print natural number between (10-20)>>>using while loop
#include <stdio.h>
// to print natural number between(10-20)
int main()
{
int num = 0;
// printf("Enter your number\n");
// scanf("%d", &num);
// while(num>9&& num<20){ // this rule is also valid
// printf("%d\n",num);
// num++;
// the another rule is below
while (num <= 20)
{
if (num >= 10)
{
printf("The value of num is %d\n", num);
}
num++;
}
return 0;
}
Comments
Post a Comment