-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBeautifulWord.c
42 lines (38 loc) · 972 Bytes
/
BeautifulWord.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdio.h>
#include <stdlib.h>
//Beautiful Word.
//To check if :
// 1- two consecutive characters of the string are same.
// 2- two consecutive characters of the string are vowels.
// if yes: the word is not beautiful, else it is beautiful.
int main()
{
char word[50];
printf("Enter the word:");
int decider=0;
scanf("%s",&word);
int i=0;
while(word[i]!='\0')
{
if(word[i]==word[i+1])
{
decider=1;
break;
}
else if(word[i]=='a' || word[i]=='e' || word[i]=='i' || word[i]=='u' || word[i]=='o' || word[i]=='y' )
{
if(word[i+1]=='a' || word[i+1]=='e' || word[i+1]=='i' || word[i+1]=='u' || word[i+1]=='o' || word[i+1]=='y')
{
decider=1;
break;
}
}
i++;
}
if(decider==1)
{
printf("The word is not beautiful");
}
else
printf("The word is beautiful");
}