Skip to main content

Posts

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

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

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

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 for Addition of Two Numbers(2 Variables)

In this easy coded program, you will learn how the addition 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 Addition of Two Numbers /*Addition 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 Addition of %d and %d is %d." , a, b, a + b);     /*You can exclude the step below.*/     printf( " \n i.e. %d+%d=%d" , a, b, a + b); }   Output Enter Two Numbers : 5 7 The Addition o...