Skip to main content

Posts

Showing posts with the label Remainder of Two Numbers using Two Variables

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...

C Program to Print Even Numbers from 1 to 'n'- while Loop

In this easy coded program, you will learn how to print even numbers from 1 to 'n' using while loop. Here, 'n',i.e. the end point will be given by the user and hence we will need to take input of the same. --------------------------------------------------------------------------- Program to Print Even Numbers from 1 to 'n' /*Even Numbers from 1 to n- while Loop*/ #include<stdio.h> void main () {     int i =2 , num;     printf( "Enter Number: " );     scanf( "%d" , & num);     while (i <= num)     {                 printf( "%d \t " , i);                 i +=2 ;     } }   Outpu...

C Program for Remainder of Two Numbers(2 Variables)

In this easy coded program, you will learn how the remainder of two numbers takes place using two variables. Actually, using less variables is preferred the most wherever possible. Rather, the same program can also be solved using three variables. --------------------------------------------------------------------------- Program for Remainder of Two Numbers /*Remainder of Two Numbers using Two Variables*/ #include<stdio.h> void main () {     int a, b;     printf( "Enter Two Numbers: " );     scanf( "%d %d" , & a, & b);     printf( " \n The Remainder of %d and %d is %d." , a, b, a % b); }   Output Enter Two Numbers : 7 5 The Remainder of 7 and 5 is 2. --------------------------------------------------------------------------- Hope you found this ' C Program for Remaind...