Complete the program named Message that accepts a user’s message and determines whether it is short enough for a social networking service that does not accept messages of more than 140 characters. If the message is less than 140 character, show The message is ok, else show The message is too long. The following picture shows an example output when you enter “Hello”. (10 points)
using static System.Console;
class Message
{
static void Main()
{
string message;
int length = 0;
const int MAX = 140;
Write ("Enter your short message >> ");
message = ReadLine();
length = message.Length; //find the length of the read-in string
// Have your code in the box below using IF
ANSWER :
CODE :
using static System.Console;
class Message
{
static void Main()
{
string message;
int length = 0 ;
int count = 0 ;
const int MAX = 140;
Write ("Enter your short message >> ");
message = ReadLine();
length = message.Length; //find the length of the read-in
string}
if(count<=140) //checking the condition
{
WriteLine("The message is ok."); //printing output
}
else
{
WriteLine("The message is too long."); //printing output
}
}
}
OUTPUT ;
Get Answers For Free
Most questions answered within 1 hours.