Write a program to accept a number and print odd numbers from 1 to n or 15 whichever small using break and continue.
/* Write a program to accept a number and print odd numbers from 1 to n or 15 whichever small
using break
and continue.*/
#include
<stdio.h>
void main()
{
int n,i;
printf("Enter the number : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i>15)
break;
if (i%2==0)
continue;
printf("%d\t",i);
}
printf("\n");
getch();
}
Comments
Post a Comment