Professional Documents
Culture Documents
EED1010 Lab2 2018502090
EED1010 Lab2 2018502090
Task 1
#include<stdio.h>
#include<string.h>
int main()
int i,j,k=0,x,y,z;
printf("Enter two words ( SMALL LETTERS ONLY ) to find out they are anagram or not.\n\n");
y=strlen(word2);
if(k==0){
else if(x!=y){
else{
z=anagram(word1,word2); //call function
}else{
int a,b,c,d,e;
int letters1[50]={0},letters2[50]={0};
for(b=0;b<c;b++){
letters1[a]++;
letters2[a]++;
b=0;
b++;
return 1;
Task 2
#include<stdio.h>
#include<string.h>
int main()
printf("Enter a sentence:\n");
printf("\n\n");
printf("%c", s[k]);
k--;
printf(" ");
}
Task III
My code not working properly but its work. Error is in main for loop.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#define N 20
int main(){
int n,m,j,a=0,b=0,d,ck,w;
char line[50];
char word[50];
char c;
for(m=0;m<50;m++){
line[m]='_';
srand(time(NULL));
n=rand()%20;
printf("%s",word_database[n]);
m=strlen(word_database[n]);
printf("\n*****HANGMAN GAME*****\n");
for(j=0;j<m;j++){
printf("%c",line[j]);
strcpy(word,word_database[n]);
for(a=0;a<10;a++){
printf("\n\nGuess:");
scanf("%c",&c);
ck=check(word,line,c);
if(ck>=1){
printf("\nRight Guess!\n");
for(d=0;d<m;d++){
printf("%c",line[d]);
}if(ck==0){
printf("\nTry Again!\n");
for(w=0;w<m;w++){
printf("%c",line[w]);
}
printf("\n\n\n");
int b=0;
int k,z=0;
k=strlen(word);
for(b=0;b<k;b++){
if(word[b]==c){
line[b]=c;
z++;
if(z>0){
return z;
}else{
return 0;