1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Elden [556K]
4 years ago
7

A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "never

odd or even" (ignoring spaces). Write a program whose input is a word or phrase, and that outputs whether the input is a palindrome.
Computers and Technology
1 answer:
seropon [69]4 years ago
3 0

Answer:

c++ program to check palindrome.

#include <bits/stdc++.h>

using namespace std;

int main() {

   string pal;

   bool b=1;

   getline(cin,pal);//taking input of a word or a line.

   int s=0,e=pal.length()-1;

   while(s<e)//loop to check palindrome.

   {

       if(pal[s]!=pal[e])

       {

           b=0;

           break;

       }

       s++;

       e--;

   }

   if(b)

       {

           cout<<"Text is palindrome"<<endl;//printing the message.

       }

       else

       {

           cout<<"Text is not palindrome"<<endl;//printing the message.

       }

return 0;

}

Output:-

geeks skeeg

Text is palindrome

geeks skeegs

Text is not palindrome

Explanation:

I have taken a string pal for the input of word or a text then I have taken two pointers one for starting and one for the end.In the loop i am keep checking the first and last characters of the string if they are same then continue otherwise break out of the loop and print not palindrome.

You might be interested in
Why do mosquitoes lay eggs in water​
d1i1m1o1n [39]

Answer: Some species of mosquitoes lay their eggs on water or on vegetation very near to water because their larval instars are aquatic. Thus, when the eggs hatch the first instar larvae will already be in the larval media. Some species of Aedes mosquitoes lay their drought resistant eggs on the soil of dried up playa lake beds. When it rains, the moisture will serve as a hatching stimulus and the eggs will hatch and spend their larval instars in the pools of rainfall. Other mosquito female will lay their eggs in the water of plant axils, tree holes and related plant habitats. In each of these instances, the immature mosquito instars require water in larval development and molt into adult insects.

hope it helps you

3 0
3 years ago
Read 2 more answers
Convert 192.16.3.1 to a Binary number
jenyasd209 [6]
Converting a decimal number into binary would be:

192/2= 96   remainder=0  
96/2= 48    remainder=0
48/2=24     remainder=0
24/2=12      remainder=0
12/2=6        remainder=0
6/2=3         remainder=0
3/2=1          remainder=1
1/2= 0         remainder=1
The binary number would be: 11 00 00 00

For 16
16/2=8     remainder=0
8/2=4      remainder=0
4/2=2       remainder=0
2/2=1         remainder=0
1/2= 0         remainder=1
The binary would be: 00 01 00 00

For 3
3/2=1       remainder=1
1/2= 0         remainder=1
The binary would be: 00 00 00 11

For 1
1/2= 0         remainder=1
The binary would be: 00 00 00 01

The binary number would be:  
11000000.00010000.00000011.00000001
5 0
4 years ago
What is the benefit of an intranet?
garik1379 [7]

Answer:

1. Access and share internal information quickly and safely

Explanation:

8 0
3 years ago
Write a for loop that will print the values 1 to 20 while skipping the odd numbers (2,4,6,8,10,12,14,16,18,20):
DochEvi [55]

<u>Answer:</u>

<em>void main ( )  </em>

<em> {  </em>

<em> int counter;  </em>

<em>  cout<<""Even numbers between 1 to 20 are:""<<endl ;  </em>

<em> //Method 1 </em>

<em>  for (counter = 1; counter <= 20; counter++)  </em>

<em>  {  </em>

<em>    if ( counter%2 == 0)  </em>

<em>   {   </em>

<em>     cout<<counter<<""\t""<<endl ;  </em>

<em>   }  </em>

<em>  }  </em>

<em>//Method 2 – simplest one </em>

<em>for (counter = 2; counter <= 20;)  </em>

<em>  {  </em>

<em>     cout<<counter<<""\t""<<endl ;  </em>

<em>counter = counter + 2; </em>

<em>    </em>

<em>  } </em>

<em> </em>

<em>  return 0;  </em>

<em>} </em>

<u>Explanation:</u>

In this, Method 1 runs a for loop and check whether each number is divided by 2. If yes, then printed otherwise it is skipped.

In the second method, it runs for loop only for even numbers. <em>This is obtained by incrementing the counter by 2. </em>

6 0
3 years ago
How often should you typically monitor your checking account? Yearly Daily Every three months Monthly
Maslowich
I’d say monthly. It probably wouldn’t kill you to do it every three months though.
7 0
3 years ago
Read 2 more answers
Other questions:
  • GIMP's official website is _____
    6·1 answer
  • This toolbar can be used to change the way the text in your presentation looks. Drawing
    5·2 answers
  • Create an application that lets the user enter the food charge for a meal at a restaurant. When a button is clicked, the applica
    13·1 answer
  • I just want to ask if some one know an online school program that offer a live session and the cost of it not to expensive. for
    10·1 answer
  • 14. What significant contribution did Gutenberg make to the printing process?
    11·2 answers
  • Original list:0,0,0,0,0,0,0,0
    10·1 answer
  • What is an example of CT SO?
    9·1 answer
  • Python - Write a program to print the multiplication table as shown in the image by using for loops.
    12·1 answer
  • true/false: the american standard code for information (ASCII) is a code that’s allows people to read information on a computer.
    9·1 answer
  • when connecting to a wireless local area network (wlan), what is the most important fact about the service set identifier (ssid)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!