C Program To Add Two Float Numbers

C Program To Add Two Float Numbers. If you are looking for the addition of two floating numbers program in C, here in this tutorial we will help you to learn how to write a c program to add two floating numbers.

C Program To Add Two Float Numbers

Just copy paste the below source code to add two float numbers in C compiler to test, how the source code works. Debug and learn how it works. Happy coding.

C Program To Add Two Float Numbers Source Code

/* C Program to Add Two Float Numbers - AddFloatNumbers.C */

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

void main( )
{
  //floating variables declaration
  float num1,num2,sum;
  clrscr( );
 
  //asking user to enter first floating number
  printf("Enter first number: ");
  scanf("%f",&num1); //reading the float number

  //asking user to enter second floating number
  printf("Enter second number: ");
  scanf("%f",&num2); //reading the second float number

  //simple addition logic to add two float numbers
  sum=num1+num2;

  //printing sum of the two float numbers
  printf("Sum of two numbers = %f",sum);
  getch( );
}

C Program To Add Two Float Numbers Output

Enter first number: 2.3

Enter second number: 4.2

Sum of two numbers = 6.5

C PROGRAMMING EXAMPLES

  1. C Program To Arrange Numbers In Descending Order
  2. C Program to Add Days to Date
  3. C Program to Add Two Fractions
  4. C Program To Reverse A Number
  5. C Program to Find Maximum and Minimum Numbers
  6. C Program to Read a Text File
  7. C Program to Convert Decimal to Hexadecimal
  8. C Program to Convert Decimal to Binary
  9. C Program to Convert Celsius to Fahrenheit
  10. C Program To Find Absolute Value
  11. Ternary Operator Program in C
  12. C Program For Addition Table Using For Loop
  13. Denomination Program in C
  14. C Program to Print Multiplication Table 
  15. C Program Array with Example
  16. Binary Search in C Program Using Recursion
  17. Bubble Sort in C Using Pointers
  18. Bubble Sort Program in C Using Recursion
  19. Bubble Sort Program in C Using Array
  20. Bubble Sort Program in C Using Function

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here