Friday, August 29, 2014

Create a program that uses the formula (f = (a b)(x y)) to output the result. This time prompt the user for the values a, b, x, and y. Use appropriate variable names and naming conventions


Code

#include<stdio.h>
int main ()
{
int a,b,x,y,f;

printf ("Enter value of a:");
scanf ("%d",&a);

printf ("Enter value of b:");
scanf ("%d",&b);

printf ("Enter value of x:");
scanf ("%d",&x);

printf ("Enter value of y:");
scanf ("%d",&y);

f = (a*b)*(x*y);

printf ("\n\nAnswer= %d",f);

printf ("\npress any key to close.");

getch ();
return 0;
}

Output


C Language using Variables

No comments :

Post a Comment

Note: Only a member of this blog may post a comment.

Copyright 2017. All Rights Reserved. Privacy Policy / Terms And Conditions / Sitemap / Contact