Please see my code below. It's not overly long or complicated.
In short the problem I am having is that my do while loop is supposed to check if the values of input or input1 are positive and if they are not then print the message onto the terminal.
However, it is always printing this message onto the terminal, even if I enter positive float values for input and input1.
Thanks for the assistance,
#include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(void)
{
float input = get_float("How much money did you pay?");
float input1 = get_float("What was the total value of the goods?");
do
{
printf("Please enter a positive *number* : ");
}
while ((input || input1) < 0.0);
int answer = round(input - input1);
{
printf("Your total change is %i: ", answer);
}
{
printf("\n");
}
}
Aucun commentaire:
Enregistrer un commentaire