Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

C Program – Multiply two floating-point numbers

Without any delay, let’s write the “C Program to Multiply two floating-point numbers“.

#include 
int main() {
	
	// define the variables
	double x, y, ans;	
	// print about the program
	printf(" -- Multiply two float numbers -- \n");
	
	// get the value of x and y
	printf("Enter x: ");
	scanf("%lf", &x);
	printf("Enter y: ");
	scanf("%lf", &y);
	
	// multiply the values
	ans = x * y;
	
	// print the answer with two decimals
	printf("The Answer is: %.2lf", ans);
	
	return 0;
}

Please go through the comments in the above program to understand the functionality.

A sample output of the above program is:

cprogramoutput

You can also read the useful program here “C Program to print Odd numbers from 1 to N!

The post C Program – Multiply two floating-point numbers appeared first on TutorialsMade.



This post first appeared on TutorialsMade - Ultimate Tutorial, please read the originial post: here

Share the post

C Program – Multiply two floating-point numbers

×

Subscribe to Tutorialsmade - Ultimate Tutorial

Get updates delivered right to your inbox!

Thank you for your subscription

×