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


Please Help Members By Posting Answers For Below Questions

Can static class have constructor?

595


What is cohesion in oop?

630


is there any choice in opting subjects like 4 out of 7

1739


Why do we need polymorphism in c#?

697


What language is oop?

603






What is static in oop?

595


How does polymorphism work?

646


Can enum be null?

594


How to hide the base class functionality in Inheritance?

652


What are the 5 oop principles?

613


What is persistence in oop?

677


What is encapsulation in oop?

613


What are oops methods?

574


What is the use of oops?

629


Why interface is used?

559