Skip to main content

Posts

Showing posts from April, 2020

C Program to Print Even Numbers from 1 to n using for Loop

In this easy coded program, you will learn how to print even numbers from 1 to 'n' using for loop. Here, 'n' is the number up to which the user wants the even numbers to be printed. --------------------------------------------------------------------------- Program to Print Even Numbers from 1 to n using for Loop /*Even Numbers from 1 to n- for Loop*/ #include<stdio.h> void main () {     int i, num;     printf( "Enter Number: " );     scanf( "%d" , & num);     for (i =2 ; i <= num; i +=2 )         printf( "%d \t " , i); }   Output Enter Number : 8 2 4 6 8 --------------------------------------------------------------------------- Hope you found this ' C Program to Print Even Numbers from 1 to n using for...

C Program to Print Odd Numbers from 1 to n using for Loop

In this easy coded program, you will learn how to print odd numbers from 1 to 'n' using for loop. Here, 'n' is the number up to which the user wants the odd numbers to be printed. --------------------------------------------------------------------------- Program to Print Odd Numbers from 1 to n using for Loop /*Odd Numbers from 1 to n- for Loop*/ #include<stdio.h> void main () {     int i, num;     printf( "Enter Number: " );     scanf( "%d" , & num);     for (i =1 ; i <= num; i +=2 )         printf( "%d \t " , i); }   Output Enter Number : 8 1 3 5 7 --------------------------------------------------------------------------- Hope you found this ' C Program to P...

C Program to Print Odd Numbers from 1 to 20 using for Loop

In this easy coded program, you will learn how to print odd numbers from 1 to 20 using for loop. --------------------------------------------------------------------------- Program to Print Odd Numbers from 1 to 20 using for Loop /*Odd Numbers from 1 to 20- for Loop*/ #include<stdio.h> void main () {     int i;     for (i =1 ; i <=20 ; i +=2 )         printf( "%d \t " , i); }   Output 1 3 5 7 9 11 13 15 17 19 --------------------------------------------------------------------------- Hope you found this ' C Program to Print Odd Numbers from 1 to 20 using for Loop ' easy, simple and helpful! Try to solve more queries by yourself by referring more examples from BEGINC . Here you will get the most eas...