![graciewilson](/avatars/45330.jpg)
graciewilson
21.03.2020 •
Computers and Technology
A palindrome number is a number that remains the same when its digits are reversed. Like 16461, for example, is a palindrome number .Write a Program to generate the Palindrome numbers between 1 and 200 in an output file named "palindrome.txt" .
Solved
Show answers
More tips
- H Health and Medicine Sunstroke: Causes, Symptoms, and Precautions...
- F Family and Home Do You Really Need a Playpen for Your Child?...
- F Food and Cooking Do Aphrodisiacs Really Work? Separating Fact from Fiction...
- C Computers and Internet Log-in: what is it and why do you need it?...
- S Style and Beauty Secrets of Tying a Pareo: 5 Ways...
- F Food and Cooking Everything You Need to Know About Pasta...
- C Computers and Internet How to Choose a Monitor?...
- H Horoscopes, Magic, Divination Where Did Tarot Cards Come From?...
Answers on questions: Computers and Technology
- S Social Studies The Ju/ hoansi believe illness and death are caused by supernatural processes. However, these processes are not the result of evil supernatural intent, but of an unfortunate misunderstanding...
- H History Based on your reading, what drove Napoleon to seek greatness? Napoleon grew up very poor in Corsica and longed for fame and glory. As a noble, he saw the fall of the French monarchy...
- M Mathematics The radius of a cylinder is measured in meters. What unit will the surface area be measured in? meters O cubic meters kilometers square meters NEXT QUESTION ASK FOR HELP TURN ITI...
- H History Negotiating treaties illustrates the president s role as a. party leader b. chief of state c. commander-in-chief of the armed forces d. foreign policy leader...
Ответ:
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;
}
Ответ:
The answer is A.
Explanation: