Write interactive C programs to perform the following on strings:
(a) To check if two strings are Anagram.
(b) To check whether the given alphabet is a vowel or consonant.
(c) To convert the given string from lower case to upper case without using the inbuilt function in
(a) To check if two strings are Anagram:
#include <stdio.h>
#include <string.h>
int isAnagram(char str1[], char str2[]) {
int len1 = strlen(str1);
int len2 = strlen(str2);
if (len1 != len2) {
return 0;
}
int count[26] = {0};
for (int i = 0; i < len1; i++) {
count[str1[i] - 'a']++;
count[str2[i] - 'a']--;
}
for (int i = 0; i < 26; i++) {
if (count[i] != 0) {
return 0;
}
}
return 1;
}
int main() {
char str1[100], str2[100];
printf("Enter two strings: ");
scanf("%s%s", str1, str2);
int result = isAnagram(str1, str2);
if (result) {
printf("Strings are Anagram ");
} else
__________ _____ ______ _______ ______ ________ __________ ______.
_____ _______ _____ _________ _______ __________ __________ _______ __________ _________ __________.
___ ____ ________ _________ _____ ____.
______ ____ ______ _____ _______ ____ _________.
__________ _____ ______ ___ ____ ________.
_______ ____ ________ __________ _____ ________ _________ __________ _____ ____.
____ ______ ___ ________ ________ __________ _______ _____ ___ _________.
____ _____ ____ ______ _______ ____ __________ _________ ______.
_______ _______ _________ ______ ______ ______ _____ _________ ___ ______ _____ ___.
________ __________ ___ _____ ___.
________ ___ ___ _______ __________.
_______ _________ ____ _______ ____ _________ ________.
_____ _______ ________ ________ ___ ___ __________ ________ _______.
_____ __________ ____ ________ _______ ______ _________ ______ ______.
_____ ______ _________ __________ ______ ______ __________.
______ ____ ____ _________ ______.
______ ________ ________ _____ ______ ______ _______ ____ ____ ____ ______.
_________ _____ ______ ________ ____ ___ ________ _________ _____ ____ ____.
________ _______ _________ _________ _________ ___ __________ _____ _______ ______ _______ ____.
_____ _____ _____ _____ _________ _______ _______ ______ __________.
__________ ___ ______ __________ ______ ______.
_________ _____ ___ _____ ____ ________ ___ ________ ___ _____ _______ ____.
_________ ______ ___ _________ _______ ______ ____ ___ ______ ______ __________ ___.
__________ ___ _________ __________ ____ ___ _______ ___.
_____ ___ ____ ____ ________ _______ _____ _______ _________ _____ _____ ________.
_____ ______ __________ _______ _______ ______ ______ _____ ________ _____ _______ ___.
_________ ______ _________ ______ ________ ______ ___ __________ ______ ______.
_______ ___ _________ _______ _________.
_________ __________ ___ ______ ___ ____ ______.
____ ______ _____ _____ __________ _______ ______ ___ __________ ______ _______ ____.
_______ _________ ____ _______ ______ ____.
______ _______ __________ ___ ___ __________.
_____ ____ ____ ___ ________ _________ _________ __________ ________ __________ _________ __________.
_________ _____ _____ _____ ________.
_______ _________ ________ _____ ____ _____.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
✓ Unlock up to 60% of the answer
✓ No payment required