#include<stdio.h> #include <ctype.h> int main() { char ch; int is_a = 1, i, coun
ID: 3614274 • Letter: #
Question
#include<stdio.h>
#include <ctype.h>
int main()
{
char ch;
int is_a = 1, i, count[26] = {0};
printf("Enter thefirst word ");
ch = getchar();
while(ch != ' ')
{
if(isalpha(ch)
{
ch = tolower(ch);
count[ch-'a']++;
}
ch = getchar();
}
printf("Enter the first secondword ");
ch = getchar();
while(ch != ' ')
{
if(isalpha(ch)
{
ch = tolower(ch);
count[ch-'a']--;
}
ch = getchar();
}
for(i=0;i<26;i++)
{
if(count[i]!=0)
is_a = 0;
}
if(is_a)
{
printf("The words are ana ");
else
printf("The words aren't ana ");
}
return 0;
ana.c:32: error:initializer element is not constant
ana.c:32: warning: data definition has no type or storage class
ana.c:33: error: syntax error before '}' token
Compilation exitedabnormally with code 1 at Fri Oct 23 14:13:23t
Explanation / Answer
please rate - thanks #include #include int main() { char ch; int is_a = 1, i, count[26] = {0}; printf("Enter the first word "); ch = getchar(); while(ch != ' ') { if(isalpha(ch)) //missing) { ch = tolower(ch); count[ch-'a']++; } ch = getchar(); } printf("Enter the first secondword "); ch = getchar(); while(ch != ' ') { if(isalpha(ch)) //missing ) { ch = tolower(ch); count[ch-'a']--; } ch = getchar(); } for(i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.