Advertisement
Guest User

oi

a guest
Sep 30th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.50 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void recomendacao (float md)
  4. {
  5.     if (md>=9)
  6.         printf("Recomendacao: 30%% de bolsa.\n");
  7.     else
  8.         if (md>=8)
  9.             printf("Recomendacao: 10%% de bolsa.\n");
  10.         else
  11.             if (md>=7)
  12.                 printf("Recomendacao: 5%% de bolsa.\n");
  13.             else
  14.                 printf("Recomendacao: 0%% de bolsa.\n");
  15.    
  16. }
  17.  
  18. int matricula (int *n, int *d, int *x)
  19. {
  20.     printf("Entre com o curso do aluno:\n");
  21.     scanf("%d", n);
  22.     printf("Entre com o o trimestre:\n");
  23.     scanf("%d", d);
  24.     printf("Entre com um numero de 1 a 90:\n");
  25.     scanf("%d", x);
  26.     if (*n!=20 || *n!=21 || *n!=22 || *n!=23 || *n!=24 || *d!=1 || *d!=2 || *d!=3 || *d!=4 || *x<1 || *x>90)
  27.         return 0;
  28.     else
  29.         return 1;
  30. }
  31.  
  32. void curso (int n)
  33. {
  34.     if (n==20)
  35.         printf ("Informatica");
  36.     else
  37.         if (n==21)
  38.             printf ("Medicina");
  39.         else
  40.             if (n==22)
  41.                 printf ("Direito");
  42.             else
  43.                 if (n==23)
  44.                     printf ("Engenharia");
  45.                 else
  46.                     printf ("Letras");
  47. }
  48.  
  49. int main (void)
  50. {
  51.     int retorno, n_, d_, x_;
  52.     float media;
  53.     retorno = matricula (&n_, &d_, &x_);
  54.     while (retorno==1)
  55.     {
  56.     printf("entre com a media geral do aluno:\n");
  57.     scanf("%f", &media);
  58.     printf ("matricula: %d%d%d", n_, d_, x_);
  59.     curso (n_);
  60.     recomendacao (media);
  61.     retorno = matricula (&n_, &d_, &x_);
  62.     }
  63.     return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement