Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Test expression



" ; " after loop



Header file



Working with switch case



Specifer




Print even and odd number in 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,j; //taking the number to continue loop from where the loop will start pf("Enter the first number: "); scanf("%d",&n); //taking the number to stop loop pf("\nEnter the second number: "); scanf("%d",&m); for(j=n;j<=m;j++) { if(j%2==0) pf("\n%d is even number.",j); else pf("\n%d is odd number.",j); } return 0; }
OUTPUT:


© 2018 - All rights reserved