0% found this document useful (0 votes)
23 views

Practicals 3 by gari

The document provides a practical programming exercise for checking if a given word is a palindrome using Visual Application Programming. It includes a design for a form with a text box and a button, along with the C# code to implement the palindrome check. A palindrome is defined as a sequence that reads the same forwards and backwards, with examples provided.

Uploaded by

Idolienhle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Practicals 3 by gari

The document provides a practical programming exercise for checking if a given word is a palindrome using Visual Application Programming. It includes a design for a form with a text box and a button, along with the C# code to implement the palindrome check. A palindrome is defined as a sequence that reads the same forwards and backwards, with examples provided.

Uploaded by

Idolienhle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Visual Application Programming Practical by S.

Garigaraganapathy, ATI - Jaffna

Program to check weather a given word is a palindrome or not?

Design a form as shown above.

Name of the text box is txtWord

Name of the button is btnCheck

Insert following code to btnCheck event.


private void btnCheck_Click(object sender, EventArgs e)
{
string w, rw;
w=txtWord.Text;
rw = "";
for (int i = w.Length - 1; i >= 0; i--)
rw += w.Substring(i, 1);
if (w == rw)
MessageBox.Show("Given word is a Palindrome");
else
MessageBox.Show("Given word is not a Palindrome");
}

Note: A palindrome is a word, number, phrase, or other sequence of symbols that reads the same
backwards as forwards,
Eg: wow, deed, dad, madam ..
Visual Application Programming Practical by S.Garigaraganapathy, ATI - Jaffna

Sample Output:

You might also like