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
A____consists of many users and their information.​
grin007 [14]

<u>Active Directory</u> consist of many users and their information.

7 0
1 year ago
Read 2 more answers
An effective technology for e-training and e-learning is __________, which uses computer graphic displays that the user can adju
ruslelena [56]

Answer:d)Visual interactive simulation (VIS)

Explanation:Visual interactive simulation (VIS) is the technology that works in a system for its development and simulation application for making the system display dynamic.

The dynamic display is preferred because it creates the interest in clients and is also used for the e-learning purpose. It also helps in decision making in accordance with competitive process.

LOT, Flash and WebEx does not provide the  service for the e-teaching services with the dynamic display feature.Thus , the correct answer is option(d).

4 0
3 years ago
I have six nuts and six bolts. Exactly one nut goes with each bolt. The nuts are all different sizes, but it’s hard to compare t
juin [17]

Answer:

Explanation:

In order to arrange the corresponding nuts and bolts in order using quicksort algorithm, we need to first create two arrays , one for nuts and another for bolts namely nutsArr[6] and boltsArr[6]. Now, using one of the bolts as pivot, we can rearrange the nuts in the nuts array such that the nuts on left side of the element chosen (i.e, the ith element indexed as nutArr[i]) are smaller than the nut at ith position and nuts to the right side of nutsArr[i] are larger than the nut at position "I". We implement this strategy recursively to sort the nuts array. The reason that we need to use bolts for sorting nuts is that nuts are not comparable among themselves and bolts are not comparable among themselves(as mentioned in the question)

The pseudocode for the given problem goes as follows:

// method to quick sort the elements in the two arrays

quickSort(nutsArr[start...end], boltsArr[start...end]): if start < end: // choose a nut from nutsArr at random randElement = nutsArr[random(start, end+1)] // partition the boltsArr using the randElement random pivot pivot = partition(boltsArr[start...end], randElement) // partition nutsArr around the bolt at the pivot position partition(nutsArr[start...end], boltsArr[pivot]) // call quickSort by passing first partition quickSort(nutsArr[start...pivot-1], boltsArr[start...pivot-1]) // call quickSort by passing second partition quickSort(nutsArr[pivot+1...end], boltsArr[pivot+1...end])

// method to partition the array passed as parameter, it also takes pivot as parameter

partition(character array, integer start, integer end, character pivot)

{

       integer i = start;

loop from j = start to j < end

       {

check if array[j] < pivot

{

swap (array[i],array[j])

               increase i by 1;

           }

 else check if array[j] = pivot

{

               swap (array[end],array[j])

               decrease i by 1;

           }

       }

swap (array[i] , array[end])

       return partition index i;

}

7 0
3 years ago
What are the trinity of the computer system
barxatty [35]

Answer:

I think the answers are input, processes, output

6 0
3 years ago
Identfy two duties of the governer stationed at mombasa under portugues rule?​
Tpy6a [65]

Answer:I got u

Explanation:

6 0
2 years ago
Other questions:
  • When a cache block has been modified since being read from main memory?
    10·2 answers
  • What is the recommended size for bulleted text?
    5·2 answers
  • If you wanted to create a graph that showed how much each value contributed to the whole value, you would use a _____.
    15·2 answers
  • Solve the following equations and check your result 1) 3x=2x+18​
    5·2 answers
  • Satellite images are based on data obtained by ____________ (gps/landsat) satellites.
    5·1 answer
  • Describe an energy problem a city in 2050 will face
    6·1 answer
  • create a function that has an argument is the triple jump distance. It returns the estimate of vertical jump height. The world r
    8·1 answer
  • Brainly Question
    14·2 answers
  • to allow excel to change the cell references in a formula or function from row to row or column to column as you fill with it, y
    13·1 answer
  • In what way, if any, are problems related to conflicts? Problems and conflicts are the same thing. Problems and conflicts are th
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!