Q : Write a function in ‘C’ to print even numbers from 1 to 100.
Answer :
#include<stdio.h>
#include<conio.h>
/*============================
Girfa Student Help
print even no. 1-100 using function
==============================*/
void print();
void main()
{
clrscr();
print();
getch();
}
void print()
{
int i;
for(i=1;i<=100;i++)
{
if(i%2==0)
printf("\t%d",i);
}
}
No comments:
Post a Comment