Advertisement
Hayjerin

praticaavaliativa2018un2

May 19th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.67 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5. int main(){
  6.     int nota[5][3], piornota[3], flag=0, menor;
  7.     printf("Informe as notas dos alunos\n");
  8.     for(int i=0;i<5;i++){
  9.         printf("Aluno %d: ", i+1)/
  10.         scanf("%d %d %d", &nota[i][0], &nota[i][1], &nota[i][2]);
  11.     }
  12.     for(int i=0;i<3;i++){
  13.         for(int j=0;j<5;j++){
  14.             if(nota[j][i]<menor || flag==0){
  15.                 menor=nota[j][i];
  16.                 piornota[i]=j+1;
  17.                 flag=1;
  18.             }
  19.            
  20.         }
  21.         //printf("piornota: %d\n", piornota[i]);
  22.         flag=0;
  23.     }
  24.     for(int i=0;i<3;i++){
  25.         printf("O aluno %d tirou a nota mais baixa na prova %d\n", piornota[i], i+1);
  26.     }
  27.    
  28.     /*
  29.     srand(time(NULL));
  30.     int a[10], b[10], c[20], cont=0;
  31.     for(int i=0, j=0;i<10;i++){
  32.         a[i]=rand()%9+1;
  33.         b[i]=rand()%10+10;
  34.         c[j]=a[i];
  35.         j++;
  36.         c[j]=b[i];
  37.         j++;
  38.     }
  39.     printf("Vetor A:");
  40.     for(int i=0;i<10;i++){
  41.         printf("%d ", a[i]);
  42.     }
  43.     printf("\nVetor B:");
  44.     for(int i=0;i<10;i++){
  45.         printf("%d ", b[i]);
  46.     }
  47.     printf("\nVetor C:");
  48.     for(int i=0;i<20;i++){
  49.         printf("%d ", c[i]);
  50.     }
  51.     */
  52.     /*
  53.     int tam, flag=0;
  54.     printf("Digite a quantidade de strings desejadas: ");
  55.     scanf("%d", &tam);
  56.     setbuf(stdin, NULL);
  57.     char string[tam][50], stringaux[50];
  58.     for(int i=0;i<tam;i++){
  59.         printf("String %d: ", i+1);
  60.         gets(string[i]);
  61.         setbuf(stdin, NULL);
  62.     }
  63.     do{
  64.         flag=0;
  65.         for(int i=0;i<tam;i++){
  66.             if(strcasecmp(string[i],string[i+1])>0){
  67.                 strcpy(stringaux, string[i]);
  68.                 strcpy(string[i], string[i+1]);
  69.                 strcpy(string[i+1], stringaux);
  70.                 flag=1;
  71.             }
  72.         }
  73.     }while(flag==1);
  74.     system("cls");
  75.     printf("\t\t|Strings em ordem alfabetica|\n\n");
  76.     for(int i=0;i<tam+1;i++){
  77.         printf("%s\n", string[i]);
  78.     }  
  79. */
  80.     return 0;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement