Can someone please explain what really goes on in this code ? If I put the AND statement, the message wont show if values are less than 0 or greater than 10 ... I think I must use 1 0 logic to work this out right ? I just need someone to briefly explain it please.
#include<stdio.h> main(){ puts("enter number"); scanf("%d",num); if(num<0 || num >10) puts("yay"); } How is that IF statement different when AND is put :
#include<stdio.h> main(){ puts("enter number"); scanf("%d",num); if(num<0 && num >10) puts("yay"); } Thanks !!
numand (b) you need to pass a pointer tonumtoscanf(), notnumitself. You probably could also use an introductory computer science text.