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