Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int acontatore=0;
- int bcontatore=0;
- int ccontatore=0;
- int dcontatore=0;
- int fcontatore=0;
- int voto=0;
- printf("inserisci il voto ricevuto");
- scanf("%d", &voto);
- printf("per uscire scrive un numero -1\n");
- while(voto!=-1) {
- switch(voto){
- case 'A':
- case 'a':
- ++acontatore;
- break;
- case 'B':
- case 'b':
- ++bcontatore;
- break;
- case 'C':
- case 'c':
- ++ccontatore;
- break;
- case 'D':
- case 'd':
- ++dcontatore;
- break;
- case 'F':
- case 'f':
- ++fcontatore;
- break;
- default:
- printf("la lettera che hai inserito è errata");
- printf("inserisci un'altro voto");
- break;
- }
- }
- printf("inserisci il voto");
- scanf("%d",&voto);
- printf("ecco i risultati \n");
- printf("A: %d", acontatore);
- printf("B: %d", bcontatore);
- printf("C: %d", ccontatore);
- printf("D: %d", dcontatore);
- printf("F: %d", fcontatore);
- printf("ciao");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement