Code:
for(;;){
	printf("0) Exit\n");
	printf("1) Run\n");
	scanf("%c", &response);
	switch (response) {
		case '0':
			return 0;
		case '1':
			break;
		}

	for(i=0,t=0.0;t<TOTTIME;t+=DT,i++) {
		vs = A * sin(2*PI*F*t);
		ir1 = (vs-v1-v2)/R1;
		ir2 = (v1-v2)/R2;
		ir3 = v2/R3;
		v1 = v1 + DT * (ir1-ir2)/C1;
		v2 = v2 + DT * (ir2-ir3)/C2;
		if(i%DTPS) continue;
		printf("%f\t%f\t%f\t%f\n",t,vs,v1,v2);
		fprintf(f,"%f\t%f\t%f\t%f\n",t,vs,v1,v2);
	}}
this code is supposed to take response, print the 2nd part of the code, do the first again and ask for another response. Instead, it does it twice, not asking for a response. it executes like this:
Code:
0) Exit
1) Run
1
//data prints here
0) Exit
1) Run
//data prints here again
0) Exit
1) Run
//awaits response
the code isnt complete, obviously, but I just need to know how fix this one error. thx