C Program To Reverse A Number

C Program To Reverse A Number. If you are looking for c program to reverse digits of a number, this c programming tutorial will help you to learn and code how to write source code.

C Program To Reverse A Number

Learn how to write a c Program to reverse a number. Writing reverse a number program in C can be done using various techniques but here in this program, we show how to write a c program to reverse digits in a number using while loop in a proper way. Happy coding.

Related Programming Tutorials: 

C Program For Palindrome Number

C Program For Palindrome String

C Program To Reverse A Number Source Code

You can copy paste the below C Program to reverse a number using while loop, in c compiler to check how the source code work.

Example Source Code:

/* C Program To Reverse A Number - ReverseNumber.C */

#include <stdio.h>
int main()
{
 //variable declaration
 int n, reversedNumber = 0, remainder;

 //Asking your to enter a number to reverse
 printf("Please Enter a Number: ");
 scanf("%d", &n); //Reading user entered number

//Logic to reverse a number using while loop
 while(n != 0)
 {
   remainder = n%10;
   reversedNumber = reversedNumber*10 + remainder;
   n /= 10;
 }
 //Printing reversed Number
 printf("Reversed Number is = %d", reversedNumber);
 return 0;
}

C Program For Reverse A Number Output

When you compile and run the above c program for reverse a number, your C compiler asks you to enter the positive integer to reverse it. After entering the number, C compiler will reverse it and display.

Output:

Please Enter a Number: 56789

Reversed Number is = 98765

C PROGRAMMING EXAMPLES

  1. C Program to Find Maximum and Minimum Numbers
  2. C Program to Read a Text File
  3. C Program to Convert Decimal to Hexadecimal
  4. C Program to Convert Decimal to Binary
  5. C Program to Convert Celsius to Fahrenheit
  6. C Program To Find Absolute Value
  7. Ternary Operator Program in C
  8. C Program For Addition Table Using For Loop
  9. Denomination Program in C
  10. C Program to Print Multiplication Table 
  11. C Program Array with Example
  12. Binary Search in C Program Using Recursion
  13. Bubble Sort in C Using Pointers
  14. Bubble Sort Program in C Using Recursion
  15. Bubble Sort Program in C Using Array
  16. Bubble Sort Program in C Using Function
  17. Bubble Sort Program in C Using Linked List
  18. Stack Push Pop Program in C Using Arrays
  19. Factorial Program in C Using Pointers
  20. Factorial Program in C Using While Loop

C Program To Find Maximum And Minimum Numbers In An Array

C Program To Find Maximum And Minimum Numbers In An Array. If you are looking for finding maximum and minimum elements of an array program, this C programming tutorial will help you to learn how to write source code for finding maximum and minimum numbers in an array.

C Program To Find Maximum And Minimum Numbers

Learn how to write a c Program to find maximum and minimum numbers in an array. Writing minimum and maximum numbers program in C can be done using various techniques but here in this program, we show how to write a c program to find maximum and minimum elements in array in a proper way. Happy coding.

C Program To Find Maximum And Minimum Elements – Source Code

You can copy paste the below C Program to find maximum and minimum numbers in an array using for loop, in c compiler to check how the source code work.

Example Source Code:

/* C program to find maximum and minimum numbers in array */

#include <stdio.h>
int main()
{
 //variable declaration
 int arr[100]; //array of integer type declaration
 int i, max, min, size; //integer variables

/* Asking user to enter size of the array */
 printf("Enter size of the array: ");
 scanf("%d", &size); //reading array size from user

/* Asking user to enter array elements */
 printf("Enter elements in the array: ");
 for(i=0; i<size; i++)
 {
 scanf("%d", &arr[i]); //reading array elements
 }


/* Assume first element as maximum and minimum */
 max = arr[0];
 min = arr[0];

/* Finding maximum and minimum elements in an array */
 for(i=1; i<size; i++)
 {
 /* If current element of array is greater than max */
 if(arr[i]>max)
 {
 max = arr[i];
 }

/* If current element of array is smaller than min */
 if(arr[i]<min)
 {
   min = arr[i];
 }
 }

/* Printing maximum and minimum elements of an array */
 printf("Maximum element = %d\n", max);
 printf("Minimum element = %d", min);

return 0;
}

C Program To Find Maximum And Minimum Elements – Output

After you compile and run the above c program to find maximum and minimum numbers in array, your C compiler asks you to enter the array size and array elements. After entering size and elements, compiler will check for maximum and minimum numbers and display.

Output:

Enter size of the array:
Enter elements in the array: 5 10 15 -5 20
Maximum element = 20
Minimum element = -5

C PROGRAMMING EXAMPLES

  1. C Program to Read a Text File
  2. C Program to Convert Decimal to Hexadecimal
  3. C Program to Convert Decimal to Binary
  4. C Program to Convert Celsius to Fahrenheit
  5. C Program To Find Absolute Value
  6. Ternary Operator Program in C
  7. C Program For Addition Table Using For Loop
  8. Denomination Program in C
  9. C Program to Print Multiplication Table 
  10. C Program Array with Example
  11. Binary Search in C Program Using Recursion
  12. Bubble Sort in C Using Pointers
  13. Bubble Sort Program in C Using Recursion
  14. Bubble Sort Program in C Using Array
  15. Bubble Sort Program in C Using Function
  16. Bubble Sort Program in C Using Linked List
  17. Stack Push Pop Program in C Using Arrays
  18. Factorial Program in C Using Pointers
  19. Factorial Program in C Using While Loop
  20. C Program For Factorial Using For Loop

C Program To Read A Text File

C Program To Read A Text File. If you are looking for a C program to read a text file and display example, this C programming tutorial will help you to learn how to write a program for reading a text file in C. Just go through this C programming example to learn about reading a file program in C.

C Program To Read A Text File

Learn how to write a c Program to read a text file. Writing IO file reading program in C can be done using various techniques but here in this program, we show how to write a c program to read a line from file and display in a proper way. Happy coding.

C Program to Read Text from a File  – Source Code

You can copy paste the below C Program to read text from a file  Using while fgetc() function, in c compiler to check how the source code work.

Example Source Code:

/* C program to read text from a file - ReadingFile.C */

#include <stdio.h>
#include <stdlib.h> //for exit() function
 
void main()
{
 //variables declaration
 FILE *fptr;
 char filename[15];
 char ch;

 //asking user to enter file name
 printf("Enter the filename to be opened \n");
 
 //rading file name from user
 scanf("%s", filename);

 /* opening the file for reading */
 fptr = fopen(filename, "r");
 if (fptr == NULL)
  {
   printf("Cannot open file \n");
   exit(0);
  }
  ch = fgetc(fptr);
  while (ch != EOF)
  {
   printf ("%c", ch);
   ch = fgetc(fptr);
  }
 fclose(fptr);
}

C Program to Read Text from a File – Output

After you compile and run the above c program to read text from a file and display, your C compiler asks you to enter the filename to read the text and display. After you enter a .txt file name, the compiler will read the file and display its text.

C PROGRAMMING EXAMPLES

  1. C Program to Convert Decimal to Hexadecimal
  2. C Program to Convert Decimal to Binary
  3. C Program to Convert Celsius to Fahrenheit
  4. C Program To Find Absolute Value
  5. Ternary Operator Program in C
  6. C Program For Addition Table Using For Loop
  7. Denomination Program in C
  8. C Program to Print Multiplication Table 
  9. C Program Array with Example
  10. Binary Search in C Program Using Recursion
  11. Bubble Sort in C Using Pointers
  12. Bubble Sort Program in C Using Recursion
  13. Bubble Sort Program in C Using Array
  14. Bubble Sort Program in C Using Function
  15. Bubble Sort Program in C Using Linked List
  16. Stack Push Pop Program in C Using Arrays
  17. Factorial Program in C Using Pointers
  18. Factorial Program in C Using While Loop
  19. C Program For Factorial Using For Loop
  20. Factorial Program in C Using Recursion Function

C Program To Convert Decimal To Hexadecimal

C Program To Convert Decimal To Hexadecimal. If you are looking for a C program to convert decimal number to hexadecimal number example, this C programming tutorial will help you to learn how to write a program for decimal to hexadecimal in C. Just go through this C programming example to learn about decimal to hexadecimal conversion.

C Program To Convert Decimal To Hexadecimal

Learn how to write a c Program to convert decimal number to hexadecimal number. Writing decimal to hexadecimal conversion program in C can be done using various techniques but here in this program, we show how to write a c program for decimal to hexadecimal in a proper way. Happy coding.

Decimal To Hexadecimal Conversion Examples

Here coding compiler will give you the decimal to hexadecimal conversion examples. A decimal number consists of base 10, i.e (0 to 9) and a hexadecimal number consists of base 16 or hex, i.e (0 to 9) to represent values zero to nine and (a, b, c, d, e, f) to represent values from ten to fifteen. Use this decimal to hexadecimal converter tool to convert numbers.

Decimal To Hexadecimal Conversion

  • Decimal – Hexadecimal
  •      10       –   A
  •     15      –    F
  •    25      –    19
  •    50     –     32
  •    75     –     4B
  •    99    –      63

Related Program: C Program to Convert Decimal to Binary

C Program For Decimal To Hexadecimal Conversion Source Code

You can copy paste the below C Program For Decimal To Hexadecimal Conversion Using while loop, in c compiler to check how the source code work. Or write your own decimal to hexadecimal C Program with the help of this below c programming tutorial.

Source Code:

/* C program to Convert Decimal to Hexadecimal - DecimalToHex.C */

#include <stdio.h>
 
int main()
{
 //variable declaration
 long decimalnum, quotient, remainder;
 int i, j = 0;
 char hexadecimalnum[100];
 
 //asking user to enter decimal value
 printf("Enter a Decimal Number: ");
 //reading user entered decimal value
 scanf("%ld", &decimalnum);
 
 quotient = decimalnum;
 
 //logc for converting decimal value to hexadecimal value
 while (quotient != 0)
 {
   remainder = quotient % 16;
   if (remainder < 10)
   hexadecimalnum[j++] = 48 + remainder;
   else
   hexadecimalnum[j++] = 55 + remainder;
   quotient = quotient / 16;
 }
 
 // displaying integer into character
 for (i = j; i >= 0; i--)
 printf("%c", hexadecimalnum[i]);
 return 0;
}

C Program To Convert Decimal Number To Hexadecimal Number Output

After you compile and run the above c program to convert decimal number to hexadecimal number, your C compiler asks you to enter the decimal number to convert into a hexadecimal number. After you enter a decimal integer, the program will be executed and give output as a hexadecimal number.

Output:

Entered decimal number is = 75

It’s Hexadecimal equivalent number is = 4B

C PROGRAMMING EXAMPLES

  1. C Program to Convert Celsius to Fahrenheit
  2. C Program To Find Absolute Value
  3. Ternary Operator Program in C
  4. C Program For Addition Table Using For Loop
  5. Denomination Program in C
  6. C Program to Print Multiplication Table 
  7. C Program Array with Example
  8. Binary Search in C Program Using Recursion
  9. Bubble Sort in C Using Pointers
  10. Bubble Sort Program in C Using Recursion
  11. Bubble Sort Program in C Using Array
  12. Bubble Sort Program in C Using Function
  13. Bubble Sort Program in C Using Linked List
  14. Stack Push Pop Program in C Using Arrays
  15. Factorial Program in C Using Pointers
  16. Factorial Program in C Using While Loop
  17. C Program For Factorial Using For Loop
  18. Factorial Program in C Using Recursion Function
  19. C Program To Reverse a String Using Pointers
  20. C Program To Swap Two Numbers Using Two Variables

C Program To Convert Temperature Celsius To Fahrenheit

C Program To Convert Celsius To Fahrenheit. If you are looking for a C program to convert temperature from degree celsius to fahrenheit example, this C programming tutorial will help you to learn how to write a program for celsius to fahrenheit in C. Just go through this C programming example to learn about decimal to binary conversion.

C Program To Convert Celsius To Fahrenheit

Learn how to write a c Program to convert Celsius To Fahrenheit. Writing celsius to fahrenheit conversion program in C can be done using various techniques but here in this program, we show how to write a c program for celsius to fahrenheit in a proper way. Happy coding.

Celsius To Fahrenheit Conversion Formula

For converting temperature from celsius to fahrenheit, there is a standard formula, that is :

fahrenheit = (celsius * 9 / 5) + 32  or fahrenheit = (celsius * 1.8) + 32

By using this formula, we can write C program to convert celsius to fahrenheit.

Related Program: C Program To Convert Decimal To Binary

C Program To Convert Temperature From Celsius To Fahrenheit

You can copy paste the below C Program For Celsius To Fahrenheit Conversion using temperature conversion formula, in c compiler to check how the source code work. Or write your own decimal to binary C Program with the help of this below c programming tutorial.

Source Code To Convert Celsius To Fahrenheit

/* C program to convert celsius to fahrenheit - CelsiusFahrenheit.C */

#include<stdio.h>

 int main() {

 float celsius, fahrenheit; //variable declaration
 
 //Asking your to enter temparature in celsius degree
 printf("\n Pleas Enter Temperature in Celsius : ");

 //Reading user entered celsius value
 scanf("%f", &celsius);

//Logic to convert Celsius to Fahrenheit  
fahrenheit = ((9/5) * celsius) + 32;
//fahrenheit = (1.8 * celsius) + 32;

//This statement prints converted temparature in fahrenheit degree 
printf("\n Converted Temperature in Fahrenheit : %f ", fahrenheit);

return (0);

}

C Program To Convert Degree Centigrade To Fahrenheit Output

After you compile and run the above c program to convert celsius to fahrenheit, your C compiler asks you to enter the celsius value to convert into fahrenheit. After you enter a value, the program will be executed and give output as a fahrenheit value.

Output:

Pleas Enter Temperature in Celsius : 25

Converted Temperature in Fahrenheit : 77

C PROGRAMMING EXAMPLES

C Program To Convert Decimal To Binary Numbers

C Program To Convert Decimal To Binary.  If you are looking for a C program to convert decimal number to binary number example, this C programming tutorial will help you to learn how to write a program for decimal to binary in C. Just go through this C programming example to learn about decimal to binary conversion.

C Program To Convert Decimal To Binary

Learn how to write a c Program to convert decimal number to binary number. Writing decimal to binary conversion program in C can be done using various techniques but here in this program, we show how to write a c program for decimal to binary in a proper way. Happy coding.

Decimal To Binary Conversion Examples

Here coding compiler will give you the decimal to binary conversion examples. A decimal number consists of base 10, i.e (0 to 9) and a binary number consists of base 2, i.e (0 and 1). Use this decimal to binary converter tool to convert numbers.

Decimal To Binary Conversion

  • Decimal – Binary
  •      5       –  101
  •     15      –  1111
  •    25      –   11001
  •    50     –    110010
  •    75     –    1001011
  •    99    –     1100011

C Program For Decimal To Binary Conversion Code

You can copy paste the below C Program For Decimal To Binary Conversion Using while loop, in c compiler to check how the source code work. Or write your own decimal to binary C Program with the help of this below c programming tutorial.

Source Code:

/* C program to convert decimal to binary - Decimaltobinary.c */


#include <stdio.h>
 
void main()
{
  //variable declaration
  long num, decimal_num, remainder, base = 1, binary = 0, no_of_1s = 0;
 
  //asking user to enter decimal number
  printf("Enter a decimal number \n");
  //reading decimal number from uesr
  scanf("%ld", &num);
  decimal_num = num;
  //c programming logic to convert decimal to binary
  while (num > 0) //while loop
  {
    remainder = num % 2;
    /* To count nuber of one's in decimal umber */
    if (remainder == 1) //if statement
    {
     no_of_1s++;
    }
    binary = binary + remainder * base;
    num = num / 2;
    base = base * 10;
  }
  //printing output elements
  printf("Entered decimal number is = %d\n", decimal_num);
  printf("It's Binary equivalent number is = %ld\n", binary);
  printf("Number of 1's in the binary number is = %d\n", no_of_1s);
}

C Program To Convert Decimal Number To Binary Number Output

After you compile and run the above c program to convert decimal number to binary number, your C compiler asks you to enter the decimal number to convert into binary number. After you enter a decimal integer, the program will be executed and give output as a binary number.

Output:

Entered decimal number is = 99

It’s Binary equivalent number is = 1100011

Number of 1’s in the binary number is = 4

C PROGRAMMING Examples

C Programming Absolute Value Example

C Programming Absolute Value Example. If you are looking for C program to find absolute value of a number, this C programming tutorial helps you to learn and code how to find absolute value of a number in C. Please go through the below C programming example.

C Programming Absolute Value

Learn how to write a  c Program to find the absolute value of a number. Writing absolute value program in C can be done using various techniques but here in this program, we show how to write a program on finding absolute value in a proper way. Happy coding.

C Program To Find Absolute Value – Source Code

You can copy paste the below C Program To Find Absolute Value Using if condition, in c compiler to check how the source code work.

Source Code: 

/*C Programming Absolute Value Example - Absolute.c*/

#include<stdio.h>
#include<conio.h>
void main()
{
  int num; //variable declaration

  printf("\nEnter any number:"); //asking your to enter a number
  
  scanf("%d",&num); //reading entered value from user

  if(num< 0) //condition to check absolute value
    num = num*-1; //converting to absolute value
    printf("\nThe absolute value of given number is: %d", num);
    printf("\n press any key to exit.");
  getch();
}

C Program To Find Absolute Value – Output

After you compile and run the above c programming absolute value, your C compiler asks you to enter the number to find the absolute number. After you enter a number, the program will be executed and give output.

Output:

Enter any number: -55
The absolute value of given number is: 55
press any key to exit.

C PROGRAMMING TUTORIALS

  1. Ternary Operator Program in C
  2. C Program For Addition Table Using For Loop
  3. Denomination Program in C
  4. C Program to Print Multiplication Table 
  5. C Program Array with Example
  6. Binary Search in C Program Using Recursion
  7. Bubble Sort in C Using Pointers
  8. Bubble Sort Program in C Using Recursion
  9. Bubble Sort Program in C Using Array
  10. Bubble Sort Program in C Using Function
  11. Bubble Sort Program in C Using Linked List
  12. Stack Push Pop Program in C Using Arrays
  13. Factorial Program in C Using Pointers
  14. Factorial Program in C Using While Loop
  15. C Program For Factorial Using For Loop
  16. Factorial Program in C Using Recursion Function
  17. C Program To Reverse a String Using Pointers
  18. C Program To Swap Two Numbers Using Two Variables
  19. C Program To Swap Two Numbers Using Three Variables
  20. C Program For Prime Numbers – Check  a Number is Prime or Not

C Program To Find The Biggest Of Three Numbers Using Ternary Operator

C Program To Find The Biggest Of Three Numbers Using Ternary Operator. If you are looking for a C program to find biggest of 3 numbers example, this C programming tutorial will help you to learn how to write a program for finding the largest number in C. Just go through this C programming example to learn about finding the greatest number of three numbers.

C Program to Find the Biggest of Three Numbers

Learn how to write a  c Program to find the biggest of three numbers. Writing ternary operator program in C can be done using various techniques but here in this program, we show how to write a finding largest number program in a proper way. Happy coding.

C Program to Find the Biggest of Three Numbers – Source Code

You can copy paste the below C Program For Finding Biggest Number Using ternary operator, in c compiler to check how the source code work. Or write your own ternary operator C Program with the help of this below c programming tutorial.

Source Code:

/* C PROGRAM TO FIND BIGGEST OF THREE NUMBERS - BIGGESTNUMBER.C*/

# include <stdio.h> 
# include <conio.h> 

void main() // program execution starts from here
{ 
 
int a, b, c, big ; //variable declaration
 clrscr() ; 
 
printf("Enter three numbers : ") ; //asking user to enter 3 numbers
 scanf("%d %d %d", &a, &b, &c) ; //reading user entered 3 numbers

//Ternary operator code logic to find the biggest number 
big = (a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c) ; 
 
printf("\nThe biggest number is : %d", big) ; //printing biggest number
 getch() ; 
}

C Program To Find Biggest Number – OUTPUT

After you compile and run the above c program to find biggest number using ternary operator, your C compiler asks you to enter the three numbers to find the largest number. After you enter a number, the program will be executed and give output.

Output:

Enter three numbers : 20    30      10

The biggest number is : 30

C PROGRAMMING TUTORIALS

  1. C Program For Addition Table Using For Loop
  2. Denomination Program in C
  3. C Program to Print Multiplication Table 
  4. C Program Array with Example
  5. Binary Search in C Program Using Recursion
  6. Bubble Sort in C Using Pointers
  7. Bubble Sort Program in C Using Recursion
  8. Bubble Sort Program in C Using Array
  9. Bubble Sort Program in C Using Function
  10. Bubble Sort Program in C Using Linked List
  11. Stack Push Pop Program in C Using Arrays
  12. Factorial Program in C Using Pointers
  13. Factorial Program in C Using While Loop
  14. C Program For Factorial Using For Loop
  15. Factorial Program in C Using Recursion Function
  16. C Program To Reverse a String Using Pointers
  17. C Program To Swap Two Numbers Using Two Variables
  18. C Program To Swap Two Numbers Using Three Variables
  19. C Program For Prime Numbers – Check  a Number is Prime or Not
  20. C Program To Reverse a String with Using Function

C Program For Addition Table Using For Loop

C Program For Addition Table Using For Loop. Finding the addition table of a given number using for loop in C programming. If you are looking for a C program to find addition table example, this C programming tutorial will help you to learn how to write a program for addition table in C. Just go through this C programming example to learn about printing addition of a number.

C Program For Addition Table

Learn how to write a  c Program to Display addition table of a number. Writing addition table program in C can be done using various techniques but here in this program, we show how to write a c addition table program using for loop in a proper way. Happy coding.

C Program For Addition Table Using For Loop – Source Code

You can copy paste the below C Program For Addition Table Using While Loop, in c compiler to check how the source code work. Or write your own addition table C Program with the help of this below c programming tutorial.

Source Code:

/* C PROGRAM FOR ADDITION TABLE - ADDITIONTABLE.C */

#include<stdio.h>
#include<conio.h>
void main()
{
    int i, t, n ; //variable declaration
    clrscr() ;
    printf("Enter the table : ") ;
    scanf("%d", &t) ; //reading input from user
    printf("\nEnter the limit : ") ;
    scanf("%d", &n) ; //reading the limit of the table
    printf("\nThe table is :\n\n") ;

//c program logic for addition table using for loop
    for(i = 1 ; i <= n ; i++)
    printf("%4d + %4d = %4d\n", i, t, i + t) ;
    getch() ;
}

C Program For Addition Table – OUTPUT

After you compile and run the above c program for addition table, your C compiler asks you to enter the number to print the addition table. After you enter a number, the program will be executed and give output.

Output:

Enter the table : 5

Enter the limit : 15

The table is :
1 + 5 = 6
2 + 5 = 7
3 + 5 = 8
4 + 5 = 9
5 + 5 = 10
6 + 5 = 11
7 + 5 = 12
8 + 5 = 13
9 + 5 = 14
10 + 5 = 15

C PROGRAMMING TUTORIALS

  1. Denomination Program in C
  2. C Program to Print Multiplication Table 
  3. C Program Array with Example
  4. Binary Search in C Program Using Recursion
  5. Bubble Sort in C Using Pointers
  6. Bubble Sort Program in C Using Recursion
  7. Bubble Sort Program in C Using Array
  8. Bubble Sort Program in C Using Function
  9. Bubble Sort Program in C Using Linked List
  10. Stack Push Pop Program in C Using Arrays
  11. Factorial Program in C Using Pointers
  12. Factorial Program in C Using While Loop
  13. C Program For Factorial Using For Loop
  14. Factorial Program in C Using Recursion Function
  15. C Program To Reverse a String Using Pointers
  16. C Program To Swap Two Numbers Using Two Variables
  17. C Program To Swap Two Numbers Using Three Variables
  18. C Program For Prime Numbers – Check  a Number is Prime or Not
  19. C Program To Reverse a String with Using Function
  20. C Program to Reverse a String without Using Function

Denomination Program In C – Finding The 500, 100, 50, 20, 10, 5, 2, 1

Currency Denomination Program In C. Finding the number of 500, 100, 50, 20, 10, 5, 2, 1 rupees in entered amount. If you are looking for a C program to find denomination example, this C programming example will help you to learn how to write a program for currency denomination in C. Just go through this C programming tutorial to learn about finding the number of 500, 100, 50, 20, 10, 5, 2, 1 rupees.

Denomination Program in C

C Currency Denomination Program – Table of Contents

  • C Program to Display The Denominations of an Amount
  • C Program For Denomination of an Amount Using While Loop – Source Code
  • C Program to Read an Amount and Find Number of Notes – Output
  • C Programming Tutorials

C Program to Display The Denominations of an Amount

Learn how to write a  c Program to Display The Denominations of an Amount. Writing a currency denomination program in C can be done using various techniques but here in this program, we show how to write a c multiplication table program using while loop in a proper way. Happy coding.

C Program For Denomination of an Amount Using While Loop – Source Code

You can copy paste the below C Program For Denomination of an Amount Using While Loop, in c compiler to check how the source code work. Or write your own currency denomination C Program with the help of this below c programming tutorial.

Source Code:

/* C PROGRAM TO DISPLAY DENOMINATIONS OF AN AMOUNT - DENOMINATION.C */

#include<stdio.h>
#include<conio.h>
void main()
{
    int rs, a, b, c, d, e, f, g, h ; //variable declaration
    clrscr() ;
    printf("Enter the amount in Rupees : ") ;
    scanf("%d", &rs) ; //reding input from uer

//C Program Logic For Denomination of an Amount Using While Loop
    while(rs >= 500)
    {
        a = rs / 500 ;
        printf("\nThe no. of five hundreds are : %d", a) ;
        break ;
    }
    while(rs >= 100)
    {
        b = rs / 100 ;
        printf("\n\nThe no. of hundreds are : %d", b) ;
        break ;
    }
    while(rs >= 50)
    {
        c = rs / 50 ;
        printf("\n\nThe no. of fifties are : %d", c) ;
        break ;
    }
    while(rs >= 20)
    {
        d = rs / 20 ;
        printf("\n\nThe no. of twenties are : %d", d) ;
        break ;
    }
    while(rs >= 10)
    {
        e = rs / 10 ;
        printf("\n\nThe no. of tens are : %d", e) ;
        break ;
    }
    while(rs >= 5)
    {
        f = rs / 5 ;
        printf("\n\nThe no. of fives are : %d", f) ;
        break ;
    }
    while(rs >= 2)
    {
        g = rs / 2 ;
        printf("\n\nThe no. of Twos are : %d", g) ;
        break ;
    }
    while(rs >= 1)
    {
        h = rs / 1 ;
        printf("\n\nThe no. of ones are : %d", h) ;
        break ;
    }
    getch() ;
}

C Program to Read an Amount and Find Number of Notes – OUTPUT

After you compile and run the above c program for currency denomination, your C compiler asks you to enter the amount to find the number of 500, 100, 50, 20, 10, 5, 2, 1 rupee notes. After you enter elements, the program will be executed and give output.

Output:

Enter the amount in Rupees : 179
The no. of hundreds are : 1
The no. of fifties are : 3
The no. of twenties are : 8
The no. of tens are : 17
The no. of fives are : 35
The no. of Twos are : 89
The no. of ones are : 179

C PROGRAMMING TUTORIALS

  1. C Program to Print Multiplication Table 
  2. C Program Array with Example
  3. Binary Search in C Program Using Recursion
  4. Bubble Sort in C Using Pointers
  5. Bubble Sort Program in C Using Recursion
  6. Bubble Sort Program in C Using Array
  7. Bubble Sort Program in C Using Function
  8. Bubble Sort Program in C Using Linked List
  9. Stack Push Pop Program in C Using Arrays
  10. Factorial Program in C Using Pointers
  11. Factorial Program in C Using While Loop
  12. C Program For Factorial Using For Loop
  13. Factorial Program in C Using Recursion Function
  14. C Program To Reverse a String Using Pointers
  15. C Program To Swap Two Numbers Using Two Variables
  16. C Program To Swap Two Numbers Using Three Variables
  17. C Program For Prime Numbers – Check  a Number is Prime or Not
  18. C Program To Reverse a String with Using Function
  19. C Program to Reverse a String without Using Function
  20. C Program to Reverse a Sting Using Recursion
  21. C Program For Palindrome String
  22. C Program For Palindrome Numbers
  23. C Program To Reverse a String with Using Function
  24. C Program To Reverse a String without Using Function
  25. C Program To Reverse a String Using Recursion