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
KATRIN_1 [288]
3 years ago
13

A palindrome number is a number that remains the same when its digits are reversed. Like 16461, for example, is a palindrome num

ber .Write a Program to generate the Palindrome numbers between 1 and 200 in an output file named "palindrome.txt" .

Computers and Technology
1 answer:
xxMikexx [17]3 years ago
5 0

Answer:

Code is given below and output is attached as an image.

Explanation:

#include <iostream>

#include <fstream>

using namespace std;

bool isPalindrome(int n)

{

       // Find reverse of n

       int rev = 0;

       for (int i = n; i > 0; i /= 10)

               rev = rev * 10 + i % 10;

       // If n and rev are same,then n is a palindrome

       return (n == rev);

}

int main()

{

       int min = 1;        // Lower Bound

       int max = 200;      // Upper Bound

       ofstream myfile;

       myfile.open("palindrome.txt");

       for (int i = min + 1; i < max; i++)

               if (isPalindrome(i))

                       myfile << i << endl;

       myfile.close();

       return 0;

}

You might be interested in
2. a. Write pseudocode for a divide-and-conquer algorithm for finding valuesof both the largest and smallest elements in an arra
Lisa [10]

The pseudocode :

Pair MaxiMini(array, sizeof_array)

if sizeof_array = 1

return element as both maximum and minimum

else if sizeof_array = 2

do one comparison to find the maximum and minimum

return that pair

else

# sizeof_array > 2

recursion for maximum and minimum of the left half

recursion for maximum and minimum of the right half

one comparison determines the true max of the two elements

one comparison determines the true min of the two elements

return the pair of maximum and minimum

6 0
3 years ago
.A card that connects directly to the motherboard of the computer and has external sockets so that the computer can be connected
Temka [501]
A NIC is a computer expansion card for connecting to a network
6 0
3 years ago
How has the dependence on technology made humanity less intelligent?​
shepuryov [24]

Answer:

People now rely on the internet for answers.

Nobody truly learns stuff and keeps it with them anymore. They know they can just search it again, and get the answer.

3 0
3 years ago
Which of the following statements is false ^^^^^Please Help^^^^^^
Dvinal [7]
3, I think. I hope that is right!
3 0
3 years ago
Write a program that prints to the screen all the ASCII characters from 33 to 126. 33! 34''
leonid [27]

Answer:

#include <iostream>

using namespace std;

int main() {

   for(int i=33;i<=126;i++)//Using loop to print ASCII characters.

   {

         cout<<i<<char(i<<" ";//statement to print integer and it's ASCII characters with values.

   }

return 0;

}

Explanation:

Put a closing parenthesis i char(i after doing that code will run .Since the answer was not getting posted hence i have to come to this resort.

I have used for loop for values 33 to 126 and for printing the ascii characters I have used typecasting converting the integer to corresponding char forcefully.

6 0
3 years ago
Other questions:
  • Steffie wants to change the margins of a worksheet to Normal to align it better on a printed page. To do this, what can she do a
    5·1 answer
  • the part of the computer that provides access to the internet is the A.modem B. keyboard C. monitor or D.system unit
    7·2 answers
  • to minimize wrist injury switch frequently among touch gestures the keyboard and the mouse true or false
    15·1 answer
  • Pat practices on the keyboard to improve his typing speed. When he typed the sentence It was a rainy day, he missed typing the l
    6·1 answer
  • How do I log into PGCPS?
    14·1 answer
  • In critical thinking, an argument is:
    12·2 answers
  • Explain the working principle of computer with suitable diagram​
    15·1 answer
  • What is not recyclable in a<br> hybrid car<br> hydrogen car<br> petrol car
    15·1 answer
  • CIS261: Python Programming I home<br> &gt;<br> 6.8: LAB: Miles to track laps
    14·1 answer
  • at the command prompt, type ls -l myscript and press enter. what permissions does the myscript file have? next, type bash myscri
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!