Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main (){
- int n, chute, pontos, tent=0;
- n=42;
- pontos=1000;
- while(1){
- scanf("%i", &chute);
- if(chute<0){
- printf("apenas numeros positivos");
- continue;
- }
- tent++;
- else if(chute<n){
- printf("Voce inserio um nรบmero menor\n");
- pontos+=(chute-n)/2;
- continue;
- }
- else if(chute>n){
- printf("Voce inserio um nรบmero maior\n");
- pontos-=(chute-n)/2;
- continue;
- }
- else if(chute == n){
- break;
- }
- }
- printf("Voce acertou!\npontos = %i \ntentativas = %i\n", pontos, tent);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement