Skip to main content

Posts

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

C Program to Calculate Compound Interest

In this easy coded program, you will learn how to calculate compound interest by taking input of principle amount, number of years and rate of interest from user. Try adding final calculated amount which will include the principle amount plus the calculated compound interest in this program for your self practice.   --------------------------------------------------------------------------- Program to Calculate Compound Interest /*Compound Interest*/ #include<stdio.h> #include<math.h> void main () {         float p, n, r, ci;         printf( "Enter Principle Amount, No. of Years, Rate of Interest= " );         scanf( "%f %f %f" , & p, & n, & r);         ci = p * pow( 1+ r /100 ,n); ...

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

C Program to Find Sum of All Numbers till 'n'

In this easy coded program, you will learn how to find sum of all the numbers till 'n', where n is up to where you want the sum to be calculated. --------------------------------------------------------------------------- Program to Find Sum of Numbers Till 'n' /*Sum of All Numbers till n*/ #include<stdio.h> void main () {     int i, n, sum =0 ;     printf( "Enter Number: " );     scanf( "%d" , & n);     for (i =1 ; i <= n; i ++ )     {         sum = sum + i;     }     printf( "The sum of all the numbers till %d is %d." , n, sum); } Output   Enter Number : 20 The sum of all the numbers till 20 is 210. ----------------------------------------------------------------...

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

C Program for Remainder of Two Numbers(3 Variables)

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