Program For Even Number
The C++ Program is given below is a program to define Even numbers 0-100. When you will run this program then you will get the even number up to 100.
void main()
{
int i;
for(i=2; i<=100; i=i+2)
printf("%d,",i);
}
Friends please see this code, in this code we use a for loop. You know we used 'for loop' for repeat any statement several time or many time. So we use for loop for print Even numbers up to 100. In for loop we declare initialization=2, Condition <=100 and we increment =2. Use this for loop we get first even number 2, second is 4 and so on.
No comments:
Post a Comment