#include <stdio.h>
int main(void) {
int n ;
while((n!=42)&&(n<100)){
scanf("\n%d",&n);
printf("%d",n);
}
return 0;
}
#include <stdio.h>
int main(void) {
int n ;
while((n!=42)&&(n<100)){
scanf("\n%d",&n);
printf("%d",n);
}
return 0;
}
when input is 42 you should not print 42 but your program is printing 42 and then terminating thats all and take care of ā\nā after printing o/p.
use while(1){scanf("\n%d",&n); if(n==42)break; printf("%d\n",n);} This will work.
I think this code will work for you
include <stdio.h>
int main()
{
int n ;
scanf("%d",&n);
while((n!=42)&&(n<100))
{
printf("%d \n",n);
}
return 0;
}