Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

" ; " after loop



Iterative statement



Working with switch case



Header file



Specifer




Print first N natural number




// AHF C PROGRAM SOLVING

//solving here ITERATIVES STATEMENTS type of programming problem

#include<stdio.h> #include<math.h> #define pf printf int main() { int n,i=0; //taking number to continue loop pf("Enter any integer number: "); scanf("%d",&n); //printing a general statement pf("\nFirst %d natural number is: ",n); while(i<=n) //ending condition of the loop { pf("%d ",i); //printing every value i++; //update loop } return 0; }
OUTPUT:


© 2018 - All rights reserved