typing-program.c

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
498 B
1
Indexable
Never
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int main(){
	char ans[10];
	int score=0;
	char str[100][100]={"hello","srinath","developer","doctor"};
	system("clear");
	time_t start,stop;
	time(&start);
  printf("enter the word \n");
	for (int i=1;i<4;i++) {
		printf("%s\n",str[i]);
		scanf("%s",&ans);
		if (strcmp(ans,str[i])==0) {
			score++;
		}
	  printf("your score is %d\n",score);
	}
	time(&stop);
	printf("time taken by loop is %f",difftime(stop,start));
}
Leave a Comment