[URI Online Judge] – 1114 – Fixed Password

Write an program that keep reading a password until it is valid. For each wrong password read, write the message “Senha invalida”. When the password is typed correctly print the message “Acesso Permitido” and finished the program. The correct password is the number 2002.

Input

The input file contains several tests cases. Each test case contains only an integer number.

Output

For each number read print a message corresponding to the description of the problem.

Sample Input Sample Output
2200
1020
2022
2002
Senha Invalida
Senha Invalida
Senha Invalida
Acesso Permitido

my solution:


#include <cstdio>

int main(){
int p;
while(scanf("%d", &p) && p != 2002)
printf("Senha Invalida\n");
printf("Acesso Permitido\n");
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s