Write a program to input the limit from the user and print all the even and odd numbers up to that using for loop?
#include<stdio.h> int main() { int i,n; printf("Enter any number: "); scanf("%d",&n); for(i=1;i<=n;i++) { if(i%2==0) printf("Even number %d\n",i); else printf("Odd number %d\n",i); } return 0; }
Output
