Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Specifer



Comment



" ; " after loop



Working with switch case



Test expression




Print all natural number from a range




// 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,m; //taking the value to continue the loop as start point pf("Enter the first number: "); scanf("%d",&n); //taking the value to stop the loop pf("Enter the second number: "); scanf("%d",&m); pf("\nNatural number from %d to %d is: ",n,m); while(n<=m) //ending condition of the loop { pf("%d ",n); n++; //update loop } return 0; }
OUTPUT:


© 2018 - All rights reserved