-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathCheck whether a given string is palindrome also check whether it has atleast 2 different vowels.cs
More file actions
69 lines (66 loc) · 1.88 KB
/
Copy pathCheck whether a given string is palindrome also check whether it has atleast 2 different vowels.cs
File metadata and controls
69 lines (66 loc) · 1.88 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication114
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the string:");
string A = Console.ReadLine();
int I, L,p=0,a=0,e=0,i=0,o=0,u=0,v=0;
L = A.Length;
string pal = string.Empty;
for (I = L - 1; I >= 0; I--)
{
pal = pal + A[I];
}
if (A == pal)
{
p++;
}
for (I = 0; I < L; I++)
{
if (A[I] == 'a')
{
a++;
}
else if(A[I]=='e')
{
e++;
}
else if (A[I] == 'i')
{
i++;
}
else if (A[I] == 'o')
{
o++;
}
else if (A[I] == 'u')
{
u++;
}
}
Console.WriteLine("\n");
if (p != 0 && (a!=0&&e!=0)||(a!=0&&i!=0)||(a!=0&&o!=0)||(a!=0&&u!=0)||(e!=0&&i!=0)||(e!=0&&o!=0)||(e!=0&&u!=0)||(i!=0&&o!=0)||(i!=0&&u!=0)||(o!=0&&u!=0))
{
Console.WriteLine("The given string is an palindrome {0}={1}", A, pal);
Console.WriteLine("\n");
Console.WriteLine("2 vowels found in the given string");
Console.WriteLine("\n");
Console.WriteLine("true");
}
else
{
Console.WriteLine("false");
Console.WriteLine("\n");
Console.WriteLine("2 vowels not found");
}
Console.ReadLine();
}
}
}