Tuesday, 10 January 2012

Write a C program to print integers from 1 to n omitting the integers is divisible by 7

/* Write a C program to print integers from 1 to n omitting the integers is divisible by 7  */

#include<stdio.h>
#include<conio.h>

void main()
{
    int n,i;
    clrscr();
    printf("Enter the value of n::\n");
    scanf("%d",&n);
    printf("The required numbers are::\n");
    for(i=1;i<=n;i++)
    {
        if(i%7!=0)
        printf("%d\n",i);
    }
    getch();
}

No comments:

Post a Comment