Anagram words Write a C code that asks users to enter two words, one after the other and checks if these words are anagrams (permutations of the same letters). For instance, the words “smartest” and “mattress” are anagrams. Examplea Run 1:
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
-
Anagram words
Write a C code that asks users to enter two words, one after the other and checks if these words are anagrams (permutations of the same letters).
For instance, the words “smartest” and “mattress” are anagrams.
Examplea
Run 1:
Please enter first word: look
please enter the second word: cool
Sorry! “cool” and “look” are not anagrams.
Run 2:
Please enter first word: masters
please enter the second word: smartes
Yes! “masters” and “smartes” are anagrams.
Hint:
-
If you sort the two words that are anagrams, they will become identical! For instance, “smartest” and “masters” both sort to “aemrsstt”
-
You can use all functions in <string.h>
-
Sorting a string is exactly similar to sorting an array. You just need to know the length of the string and make sure you do not touch the terminating null.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 5 images