F
flebber
Hi
I am starting to learn c and have been playing with several simple
scripts to learn.
Question why does the request for scanf precede printf. I created a
simple script to calculate interest. When running the script though
scanf is processed first and the request for input comes first,
despite being in the second position. How do I get printf to call
first.
This is my script.
# include <stdio.h>
int main()
{
float a,b,c,interest;
printf("Type in amount in dollars cents: \n");
scanf("%f",&a);
b = 0.075;
c = a * b;
interest = a + c;
printf("The total including interest is $%.2f", interest);
return 0;
}
I am starting to learn c and have been playing with several simple
scripts to learn.
Question why does the request for scanf precede printf. I created a
simple script to calculate interest. When running the script though
scanf is processed first and the request for input comes first,
despite being in the second position. How do I get printf to call
first.
This is my script.
# include <stdio.h>
int main()
{
float a,b,c,interest;
printf("Type in amount in dollars cents: \n");
scanf("%f",&a);
b = 0.075;
c = a * b;
interest = a + c;
printf("The total including interest is $%.2f", interest);
return 0;
}