|
URI / BEE CROWD 1114 - Fixed Password - Solution in C,C++,Python | URI - BEECROWD - BEE 1114 Solution in C,C++,Python |
Write a program that keep reading a password until it is valid. For each wrong password read, write the message "Senha inválida". When the password is typed correctly print the message "Acesso Permitido" and finished the program. The correct password is the number 2002.Input
Output
For each number read print a message corresponding to the description of the problem.
Input Sample | Output Sample |
2200 1020 2022 2002 | Senha Invalida Senha Invalida Senha Invalida Acesso Permitido |
Demonstration:
This program takes user inputs. Then check the conditions for each test case contains.
Print “Senha Invalida”, if the value is 2002. Otherwise, print “Acesso Permitido”
N.B: Don't copy paste the code as same. Just try to understand it and try yourself.
URI / BEE 1114 Solution in C :
URI / BEECROWD Online Judge 1114 Solve in C : |
#include<stdio.h>
int main()
{
int n;
while(1)
{
scanf("%d",&n);
if(n==2002)
{
printf("Acesso Permitido\n");
break;
}
else
{
printf("Senha Invalida\n");
}
}
return 0;
}
URI / BEE 1114 Solution in C++ :
URI / BEECROWD Online Judge 1114 Solve in C++ : |
#include <iostream>
using namespace std;
int main(){
int a;
while(cin >> a){
if(a == 2002){
cout << "Acesso Permitido\n";
break;
}else{
cout << "Senha Invalida\n";
}
}
return 0;
}
URI / BEE 1114 Solution in Python :
URI / BEECROWD Online Judge 1114 Solve in Python : |
while(True):
try:
a = int(input())
if(a==2002):
print("Acesso Permitido")
break
else:
print("Senha Invalida")
except EOFError:
break
Previous Problem:
0 Response to URI / BEE CROWD 1114 - Fixed Password - Solution in C,C++,Python | URI - BEECROWD - BEE 1114 Solution in C,C++,Python
Post a Comment