I'm pretty new with c, the problem is when it reaches a certain line, the program freezes. i have no idea why and how to fix it. is there anything wrong with my code or is it the terminal that's broken?
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
float cinta;
float benci;
float hasil;
char nama [100];
char pacar [100];
char tanya;
int main(){
printf("hallo, selamat datang di game seberapa cinta anda! \n");
printf("siapa nama anda? ");
scanf ("%s \n",nama);
printf ("Siapa nama pacar anda? ");
scanf ("%s \n",pacar);
printf ("Apakah anda siap untuk di kalkulasi? ");
scanf ("%c \n",tanya); // here's the line
if ((tanya == 'y')||(tanya == 'Y')) {
srand(time(0));
cinta = rand() %100 +1;
benci = rand() %100 +1;
hasil = cinta + benci;
printf ("selamat \n");
} else {
hasil = 0.0;
}
printf("Your love is at %f percent", hasil);
return 0;
}