Skip to main content

Posts

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

C Program to Print Numbers from a to b using for Loop

In this easy coded program, you will learn how to print numbers from a to b using for loop, where the values of both will be taken from the user. --------------------------------------------------------------------------- Program to Print Numbers from a to b using for Loop /*Print Numbers from a to b- for Loop*/ #include<stdio.h> void main () {     int a, b;     printf( "Enter First Number: " );     scanf( "%d" , & a);     printf( " \n Enter Last Number: " );     scanf( "%d" , & b);     for ( ; a <= b; a ++ )     {         printf( "%d \t " , a);     }   Output Enter First Number : 3 Ent...

C Program to Print Numbers from b to a using while Loop

In this easy coded program, you will learn how to print numbers from b to a using while loop, where the values of both will be taken from the user. --------------------------------------------------------------------------- Program to Print Numbers from b to a using while Loop /*Print Numbers from b to a- while Loop*/ #include<stdio.h> void main () {     int a, b;     printf( "Enter First Number: " );     scanf( "%d" , & a);     printf( " \n Enter End Number: " );     scanf( "%d" , & b);     while (a >= b)     {         printf( "%d \t " , a);         -- a;     ...

C Program to Print Even Numbers from 1 to 20- while Loop

In this easy coded program, you will learn how to print even numbers from 1 to 20 using while loop. You will not need to take any input from the user as we are defining the end point. --------------------------------------------------------------------------- Program to Print Even Numbers from 1 to 20 /*Even Numbers from 1 to 20- while Loop*/ #include<stdio.h> void main () {     int i =2 ;     while (i <=20 )     {                 printf( "%d \t " , i);                 i +=2 ;     } }   Output 2 4 6 8 10 12 14 16 18 20 --------------------------------------------------------------...

C Program to Print Numbers from 'n' to 1 (while Loop)

In this easy coded program, you will learn how to print numbers from 'n' to 1 using while loop, where 'n' is taken from the user. You will have to take input of the first number that the user wants to print and simply write the code for its execution. --------------------------------------------------------------------------- Program to Print Numbers from 'n' to 1 (while Loop) /*Print Numbers from n to 1- while loop*/ #include<stdio.h> void main () {     int num;     printf( "Enter Number: " );     scanf( "%d" , & num);     while (num >=1 )     {         printf( "%d \t " ,num -- );     } }   Enter Number : 7 7 6 5 4 ...