Espresso-C Espresso-C
Download
Download Free

printf and scanf

there is something wrong with printf statements here is a sample code which explains the problem

/* Computes net tire slaes*/

#include

int main()
{
int numTires;
float tirePrice, beforeTax, netSale;
float taxRate=.07; /* Sales tax*/
/* Ask user for values*/
printf("How many tires purchased?n ");
scanf(" %d", &numTires);
printf("How much is each tire?n ");
scanf(" %f", &tirePrice);
/*compute the sale*/
beforeTax = tirePrice * numTires;
netSale = beforeTax + (beforeTax * taxRate);
printf("Your total sale is %.2fn", netSale);
return 0;
}

the user should be prompted to insert an integer after the first prompt
the user should be prompted to insert a floating number after the second prompt
or is there something worng with my syntax?

colonel_dirty about Espresso-C

Download from Mac App Store

Espresso-C

Espresso-C

Verto Studio LLC

*** Related to scanf: scanf works just fine if you add a fflush(stdout); call just prior to calling it. *** Espresso-C is a compiler and learning tool designed to execute code ver...

Get application

App Details

Version
1.2
Size
44.72 Mb
Updated
9 years ago
Released
Sep 2014
Price
Free
Platform
MacOS

Get in Touch

[email protected] Report abuse

This site

Site powered by Softwario — free mini-sites for app developers.

Create a free site for your app →

© 2015 – 2026 Softwar.io — SaaS service: free application sites for developers and Mac apps catalog.
© Application developer: Verto Studio LLC. This application website is not affiliated with the developer.

Privacy EULA Abuse