Program
#include <stdio.h> int main() { printf("****************************************************************"); printf("\n****************************************************************"); printf("\n** WAP to print even numbers from 1 to 10 using for loop **"); printf("\n** Created by Sheetal Garg **"); printf("\n** Assistant Professor **"); printf("\n** Phone No:9467863365 **"); printf("\n****************************************************************"); printf("\n****************************************************************\n"); int i; printf("\nLogic 1\n"); for (i = 2; i <= 10; i = i + 2) printf("%d\t", i); printf("\n\nLogic 2\n"); for (i = 1; i <= 10; i++) if (i % 2 == 0) printf("%d\t", i); return 0; }
Output
**************************************************************** **************************************************************** ** WAP to print even numbers from 1 to 10 using for loop ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** **************************************************************** **************************************************************** Logic 1 2 4 6 8 10 Logic 2 2 4 6 8 10