#include<stdio.h> #include<conio.h> void main() { int i,ec=0,oc=0,r1,r2; clrscr(); printf("enter a r1 value:"); scanf("%d",&r1); printf("enter a r2 value:"); scanf("%d",&r2); i=r1; while(i<=r2) { if(i%2==0) ec++; else oc++; i++; } printf("the no. of even no's is:=%d\n",ec); printf("the no. of odd no's is:=%d",oc); getch(); } |
Output:-
______________________________________________________
______________________________________________________
______________________________________________________
_____________________________________________________
Post a Comment