typing-program.c

 avatar
unknown
c_cpp
2 years ago
498 B
3
Indexable
#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));
}
Editor is loading...
Leave a Comment