Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4.     int NILAI[12] = {60,80,55,90,75,40,50,85,70,65,45,55};
  5.     int LULUS[12] ={};
  6.     int GAGAL[12] ={};
  7.     int I, J,K;
  8.    
  9.     printf("Isi Array A : ");
  10.     for (I=0; I<12; I++) {
  11.         printf("%3i", NILAI[I]);
  12.     }
  13.     J = 0;
  14.     for (I=0; I<12; I++) {
  15.         if (NILAI[I]>=60) {
  16.             LULUS[J] = NILAI[I];
  17.             J++;
  18.         }
  19.     }
  20.     J = 0;
  21.     for (I=0; I<12; I++) {
  22.         if (NILAI[I]<60 ) {
  23.             GAGAL[J] = NILAI[I];
  24.                 J++;
  25.         }
  26.     }
  27.     printf("\nLULUS : ");
  28.     for (I=0; I<12; I++) {
  29.             printf("%3i", LULUS[I]);
  30.     }
  31.     printf("\nGAGAL : ");
  32.     for (I=0; I<12; I++) {
  33.             printf("%3i", GAGAL[I]);
  34.     }
  35.    
  36.      return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement