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
write the implementation (.cpp file) of the gastank class of the previous exercise. the full specifiction of the class is:
o-na [289]

Answer: (no specifications)

Explanation:

Given that there is nothing listed about the class there would be no specifications for the class. This part of the question will not provide you with enough information to write code.

4 0
3 years ago
Intranets are typically set up behind a firewall. <br> a. True <br> b. False
slamgirl [31]
The answer is a. True. Hope this helps :)

~PutarPotato
4 0
3 years ago
Give four example of computer virus​
asambeis [7]

trojan virus allows some one to sneak a bunch of coruppted data or more viruses into a system. a worm is able to access some ones computer and steal information a firebug is used to crash someones computer and spyder is used to scramble some ones work and deleting it

6 0
3 years ago
After class a student asked why you would ever use a heap instead of a binary search tree. Provide a good explanation for why an
sertanlavr [38]

Answer:

Heap is useful when you want to find max/min element in the given list

BinarySearchTree is used if you need sorted elements of the list

Explanation:

Heap is Good at finding Min/Max and it's time complexity is  (O(1)), while BST is good at all finds (O(logN)). Insert is O(logN) for Heap and BSTstructures..

Max Heap ensures that elements on higher levels are greater than elements at lower level

MinHeap ensures that elements on higher levels are lesser than elements at lower level

BST gives sorted elements by following order (left,root,right).If we want sorted elements we can go with BST

5 0
3 years ago
Explain the theory of electro-magnetism
solong [7]
Electro magnetism theory cover the basic principle of electro magnetism : experimental basis.
Electromagnetism is defined as an attraction between two partical.
3 0
3 years ago
Other questions:
  • You have created a number of different documents using several applications including word, excel, and powerpoint. these files a
    10·1 answer
  • What can you say about the following Java class definition?
    10·1 answer
  • Create a new file that contains a summary of the total consumption for three sectors: "Residential," "Commercial," and "Industri
    10·1 answer
  • If you attempt an edgeunity quiz is your latest attempt the one counted?
    10·1 answer
  • Grooves and polished surfaces on desert pebbles are most likely caused by
    10·1 answer
  • PLEASE HELP!!!
    12·1 answer
  • A user complains that her computer is performing slowly. She tells you the problem started about a week ago when new database so
    12·1 answer
  • When more open-ended questions are asked in a study group, discussions are more likely to
    14·2 answers
  • Which element is represented by the electron configuration in example B? Example B: 1s22s22p63s23p64s1 Aluminum Cesium Potassium
    12·2 answers
  • Philp has taken selfie wearing T-shirt that read "California 92." However, the text is mirrored in the selfie. He wants to uploa
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!