Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Write a function to calculate the exchange rate of pounds to dollars
Answer
Td = 2xTp The parameter passed over is the number of pounds and returned the value in dollars
float convert (float x ) { float y ; /*A function which converts pounds measure X to a dollars measure*/ /*The parameter x is real and a real value y is returned*/ y = 2.0 * x; return (y); } The program which calls the function would be include include include include include void main() { char prompt; float a, b; printf("please enter in your value in pounds \n\r"); scanf("%f",&a); b= convert(a); printf("The value in dollars is %5.3f \n\r",b); b= convert(3.0); printf("The value in dollars of 3 pounds is %5.3f \n\r",b); printf("Press any key to exit \n\r"); scanf("\n%c",&prompt); }
Here the program requests the value of a in pounds, then executes function 'Convert'. This causes the program to go to the function statement, pass the variable a, to it and the output is passed back to the program. The output is then assigned to variable b and printed out. It is possible to pass a value over instead of a variable. The only amendment we have to make is to add the prototype to the program i.e.
float convert (float); This describes the type of variables passed to and from the function. Therefore the complete program and function is shown below include include include include include float convert (float); void main() { char prompt; float a, b; printf("please enter in your in pounds \n\r"); scanf("%f",&a); b= convert(a); printf("The value in dollars is %5.3f \n\r",b); b= convert(3.0); printf("The value in dollars of 3 pounds is %5.3f \n\r",b); printf("Press any key to exit \n\r"); scanf("\n%c",&prompt); } float convert (float x ) { float y ; /*A function which converts pounds measure X to a dollars measure*/ /*The parameter x is real and a real value y is returned*/ y = 2.0 * x; return (y); }
what is c language
Ravi is a newbie to the programming and while learning the programming language he came to know the following rules: · Each program must start with ''''{'''' and end with ''''}
The Conditional Expression Operator An alternate method to using a simple if-else construct is the conditional expressions operator, ?: A conditional expression operato
Objective: Construct a C program that controls the LCD display, and is capable of displaying strings. Add functions to the C program that allows more control over the display.
THIS PROGRAM IS TO COMPARE THE TWO DATES GIVEN BY THE USER #include #include #include struct date { int dd; int mm; int yy; }; date compare(date d1,date d2) {
I need a project on car rental system using c programming only of college level
void main() { int *p, *q, i ; p=(int*)100; q=(int*)200; i=q-p; printf("%d",i); } }
n this problem u given a board in which some of the elements are placed as shown in diagram below .each element represent a color .fill the other elements in the board such that no
I need c program for the above question.
Q: But MFC appear to encourage the employ of catch-by-pointer; should I do the similar? A: Depends. If you're utilizing MFC and catching one of their exceptions, by all means, d
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd