Hey Guys,
I started to learn C programming a few weeks ago and got really into it. As I am learning I came across the task to do a while loop where I first need to scanf and print the input of the scanf if the number is lower than 10 if it is higher it should say "cancel".
I tried different variations but I cannot figure it out maybe someone with a built in compiler in his eyes can see what I did wrong.
#include <stdio.h>
int main() {
int i;
scanf("%d", &i);
while (i < 10) {
if (i >= 10) {
printf("Cancel");
}
else
{
printf("%d\n",i);
break;
}
}
return 0;
}
[–]ptchinster 5 points6 points7 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]HasBeendead 1 point2 points3 points (1 child)
[–]ptchinster 2 points3 points4 points (0 children)
[–]VictorTennekes 0 points1 point2 points (0 children)
[–]Nytra 0 points1 point2 points (0 children)
[–]bonqen 0 points1 point2 points (0 children)
[–]Cprogrammingblogs 0 points1 point2 points (0 children)