Header Ads

Header ADS

Solution of URI 1131::Grenais

Before seeing the solution make sure that you have tried enough. Don’t copy the whole code, just find out the logic. If you feel any problemyou will inform me by comment.





#include <stdio.h>
int main(){
    int Inter=0,Gremio=0,Empates=0,Grenais=0,Inter_goal,Gremio_goal,N;

    do {
        scanf("%d%d",&Inter_goal,&Gremio_goal);

        if(Inter_goal==Gremio_goal) {
            Empates += 1;
        }
        else if(Inter_goal>Gremio_goal) {
            Inter += 1;
        }
        else {
            Gremio +=1;
        }

        printf("Novo grenal (1-sim 2-nao)\n");
        Grenais++;

        scanf("%d",&N);

    } while(N==1);

    printf("%d grenais\n",Grenais);
    printf("Inter:%d\n",Inter);
    printf("Gremio:%d\n",Gremio);
    printf("Empates:%d\n",Empates);
    printf("Inter venceu mais\n");

    return 0;
}

No comments

Theme images by konradlew. Powered by Blogger.