diogoAlves

IFF/Introdução à Programação/Slide/Pag 60/Ex 1

Mar 8th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. //IFF - Introdução à Programação
  2. //Slide - Página 60 - Exercício 1
  3. #include<stdio.h>
  4. #include<locale.h>
  5.  
  6. int Conceito(int n1, int n2){
  7.     int media=0;
  8.     media=(n1+n2)/2;
  9.     printf("\nSeu conceito foi ");
  10.     switch (media){
  11.         case 0 ... 49:
  12.             printf("D.");
  13.         break;
  14.         case 50 ... 69:
  15.             printf("C.");
  16.         break;
  17.         case 70 ... 89:
  18.             printf("B.");
  19.         break;
  20.         default:
  21.             printf("A.");
  22.     }
  23.     return media;
  24. }
  25.  
  26. int main(){
  27.     int n1,n2,media;
  28.     printf("Entre com as notas da p1 e p2 respectivamente: ");
  29.     scanf("%d%d",&n1,&n2);
  30.     media=Conceito(n1,n2);
  31.     if(media>=6) printf("\n\nAprovado."); else printf("\n\nReprovado.");
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment