Even number Without IF, For loop

This program to print all the even numbers Upto an Upper-Limit entered by the user.Use functions to print the above series of number. Without using 'if'. This is a part of Mumbai University MCA Colleges C Programs MCA Sem 1


#include<stdio.h>
#include<conio.h>
int calceven(int);
void main()
{
int j;
clrscr();
printf("Enter the limit:");
scanf("%d",&j);
printf(""The Even Numbers:");
calceven(j);
getch();
}
int calceven(int j)
{
int i;
for(i=2;i<=j;i+=2)
{
printf("%d\n",i);
}
return(i);
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

No comments:

Post a comment