I am trying to make it to where when I press enter on input, it will proceed to the next part of the code e.g:
int first
int second
int answer
printf("Enter first number\n");
scanf("%d", &first);
printf("Enter second number\n");
scanf("%d", &second);
first + second = answer
printf("%d", answer);
return 0
that was just an example but my code is this:
#include <stdio.h>
int main()
{
int pennies;
int dollars;
printf("How many pennies are in __ dollars?\n");
scanf("%d", &dollars);
pennies = dollars*100;
printf("There are %d pennies\n", pennies);
return 0;
}
And when I run it on terminal,it will ask "How many pennies are in __ dollars?" just like it should.
The problem is when I type in 7, it will just skip down a line and go on forever. I am trying to get it to where when I press enter, it will multiply 7 * 100 and output "There are 700 pennies". Please help.
(to those who saw this earlier, I forgot to remove scant("%d%*c", dollars); and just have scanf("%d", dollars); and that solution didn't work either)