Program to check whether a word is in all capital letters
Answer Posted / shadab alam
using System;
class a
{
public static void Main()
{
Console.WriteLine("Enter a word ");
string s=Console.ReadLine();
char []c=s.ToCharArray();
int ctr=0;
for(int i=0;i<c.Length;i++)
{
if(c[i]>=65 && c[i]<=90)
{
ctr++;
}
else
{
ctr=0;
}
}
if(ctr>0)
{
Console.WriteLine("word are in
capital letter");
}
else
{
Console.WriteLine("word are not in
all capital letter");
}
}
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What is for loop and its syntax?
What is class and object in oops?
Where You Can Use Interface in your Project
class type to basic type conversion
What is multilevel inheritance in oop?
What is meant by oops concept?
to find out the minimum of two integer number of two different classes using friend function
Can enum be null?
What is the real time example of encapsulation?
What is encapsulation in simple terms?
Can an interface inherit a class?
class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash
Why oops is important?
What is the diamond problem in inheritance?
How do you use inheritance in unity?