C PROGRAM TO PRINT 1 TO N EXCEPT 4

  

Consider the following I/O samples.


SAMPLE INPUT: 10

SAMPLE OUTPUT: 1 2 3 5 6 7 8 9 10



C PROGRAM:

#include<stdio.h>

int main()

{

    int n,i;

    scanf("%d",&n);

    printf("\n");

    for(i=1;i<=n;i++)

    {

        if(i==4)

        continue;

        printf("%d ",i );

    }

    return 0;

}


OUTPUT:





The given source code in C program "to print 1 to N except 4" is short and simple to understand. The source code is well tested in DEV-C++ and is completely error free. 

If you have any feedback about this article and want to improve this, please comment in the comment section.




Comments