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

Popular posts from this blog

Write a program to accept numerator and denominator and find the remainder without using modulus (%) operator using do..while loop.