Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Latest Posts

C Program to Multiply two Floating Point Numbers

In this program, user is asked to enter two floating point numbers and this program will mulitply these two numbers and display it.

Source Code


/*C program to multiply and display the product of two floating point numbers entered by user. */

#include <stdio.h>
int main( )
{
    float num1, num2, product;
    printf("Enter two numbers: ");
    scanf("%f %f",&num1,&num2);        /* Stores the two floating point numbers entered by user in variable num1 and num2 respectively */
    product = num1*num2;  /* Performs multiplication and stores it */
    printf("Product: %f",product);
    return 0;
}
Output
Enter two numbers: 2.4
1.1
Product: 2.640000
Explanation
In this program, user is asked to enter two floating point numbers. These two numbers entered by user will be stored in variables num1 and num2 respectively. This is done using scanf( ) function. Then, * operator is used for multiplying variables and this value is stored in variable product.

Click Here For More example in c introduction chapter

Go Back on Home Chapter By Clicking below Button :)
If above button is not working then copy the below link and paste in your address bar.

http://www.mastercaptainit.com/p/c-programming-tutorial.html


No comments:

Post a Comment

Master Captain IT Designed by Master Captain It Team. Copyright © 2014

.
Theme images by Bim. Powered by Blogger.