Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/ #include <stdio.h> int main() { int x; while(1) { scanf("%d", &x); if(x==2002) { printf("Acesso Permitido\n"); break; } else printf("Senha Invalida\n"); } return 0; }
#include
ReplyDeleteint main ()
{
int i,a,b=2002;
for(i=0;i<100;i++){
scanf("%d",&a);
if(a==b) printf("Acesso Permitido\n");
if(a>b || a<b)printf("Senha Invalida\n");
}
return 0;
}
why this in not accepting??
Because the question says when the password is typed correctly then the program is finished, But your code says the loop run 100 times and doesnt matter the password is typed correctly or not
Delete