1
I have the following code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
float a, b, c, delt, c0, c1, c2;
char s;
int op = 1;
printf("Welcome.\n\n");
while (op == 1) {
printf("Please type: a, b c.\n\n");
printf("a:");
scanf("%f",&a);
printf("b:");
scanf("%f",&b);
printf("c:");
scanf("%f",&c);
delt = b*b;
printf("%c \n",delt);
printf("Do you want repeat? (y/n)");
scanf("%c",&s);
if (s != "y") {
op = 0;
}
}
return 0;
}
Why the last scanf()
does not wait for the entrance to follow with the if
and decide whether the proceedings may be closed?
I am using the GNU C Compiler copier if it is useful.
You are mixing types. If you use quotes ", you are working with string
char*
, while with apostrophe, the work is done at the character levelchar
– Jefferson Quesado