#include <stdio.h> void main() { int i,works2,notgotwork,works1,got2=0,got1=0,notgot=0; clrscr(); for (i=1;i<=20;i++) { //1=yes; 0=not// printf("got any work? "); scanf("%d",¬gotwork); if (notgotwork==0) notgot+=1; printf("got 1 work? "); scanf("%d",&works1); if (works1==1) got1+=1; printf("got 2 works?"); scanf("%d",&works2); if (works2==1) got2+=1; } printf("got 0: %d",got1); printf("got 1: %d",got2); printf("got 2: %d",notgot); }
|