Computer Science, asked by rameshmath6591, 11 months ago

Write a program to printout addition of even numbers 1 to 10 in basic programme

Answers

Answered by harshitha16732
0

Below Code of C prints even and odd numbers:

void main()

{

printf("even numbers are: ");

for(int i=0;i<=20;i%2==0&&printf("%d",i),i++);

printf("\n");

printf("odd numbers are:");

for(int i=0;i<=20;i%2==1&&printf("%d",i),i++);

}

3.3k views ·

Below is the C program for the same:

3.7k views

#include<stdio.h>

int main()

{

int i;

for(i=0;i<=20;i+=2)printf(“%d\n”,i);

for(i=1;i<=20;i+=2)printf(“%d\n”,i);

return 0;

}

hope this answer helps you

Similar questions