You are on page 1of 2

// Sting Pairs

#include<stdio.h>
int countVowels(char str[]){
int i,v=0;
for(i=0;str[i]!='\0';i++){
if(str[i]=='a' || str[i]=='e'|| str[i]=='i' || str[i]=='o' ||
str[i]=='u'){
v++;
}
}
return v;
}

int printPairs(int arr[], int n, int sum)


{
int count = 0, i,j;
for (i = 0; i < n; i++)
for (j = i + 1; j < n; j++)
if (arr[i] + arr[j] == sum)
count++;
return count;
}

int main(){
char *single_digits[] = { "zero", "one", "two", "three",
"four","five", "six", "seven", "eight", "nine"};
char *two_digits[] = {"", "ten", "eleven", "twelve", "thirteen",
"fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"};
char *tens_multiple[] = {"", "", "twenty", "thirty", "forty", "fifty",
"sixty", "seventy", "eighty", "ninety"};
char str[20];
int a[100],i,n,nov=0, num, nopairs;

scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}

for(i=0;i<n;i++){
num = a[i];
if(num==100){
nov = nov + countVowels("hundred");
}
else if (num <=10) {
nov = nov + countVowels(single_digits[num]);
}
else if(num>10 && num<=19) {
nov = nov + countVowels(two_digits[num]);
}
else {
nov = nov + countVowels(single_digits[num%10]);
nov = nov + countVowels(tens_multiple[num/10]);
}
}
nopairs = printPairs(a, n, nov);
printf("%s",single_digits[nopairs]);
}

You might also like