SHARE
TWEET

Untitled

a guest Dec 8th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // problem A
  2. #include<stdio.h>
  3.  
  4. struct studentData{
  5.   char name[101];
  6.   char nim[10];
  7.   int age;
  8.   char pc[7];
  9.   char pob[101];
  10.   char dob[101];
  11.   char hs[101];
  12.   int sib;
  13.   int height;
  14.   char bank[10];
  15. } student[101];
  16.  
  17. void printStudent(int N){
  18.   for(int n=1; n<=N; n++){
  19.     printf("Mahasiswa ke-%d:\n", n);
  20.     printf("Nama: %s\n", student[n].name);
  21.     printf("NIM: %s\n", student[n].nim);
  22.     printf("Umur: %d\n", student[n].age);
  23.     printf("Kode Pos: %s\n", student[n].pc);
  24.     printf("Tempat Lahir: %s\n", student[n].pob);
  25.     printf("Tanggal Lahir: %s\n", student[n].dob);
  26.     printf("Almamater SMA: %s\n", student[n].hs);
  27.     printf("Jumlah Saudara Kandung: %d\n", student[n].sib);
  28.     printf("Tinggi Badan: %d\n", student[n].height);
  29.     printf("NOMOR REKENING: %s\n", student[n].bank);
  30.   }
  31. }
  32.  
  33. int main(){
  34.   int N;
  35.   scanf("%d", &N); getchar();
  36.  
  37.   for(int n=1; n<=N; n++){
  38.  
  39.     scanf("%[^\n]", &student[n].name); getchar();
  40.     scanf("%s", &student[n].nim); getchar();
  41.     scanf("%d", &student[n].age); getchar();
  42.     scanf("%s", &student[n].pc); getchar();
  43.     scanf("%[^\n]", &student[n].pob); getchar();
  44.     scanf("%s", &student[n].dob); getchar();
  45.     scanf("%[^\n]", &student[n].hs); getchar();
  46.     scanf("%d", &student[n].sib); getchar();
  47.     scanf("%d", &student[n].height); getchar();
  48.     scanf("%s", &student[n].bank); getchar();
  49.  
  50.   }
  51.   printStudent(N);
  52.  
  53.   return 0;
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top