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;
}
Answer:
The program to this question can be given as:
Program:
#include <stdio.h> //include header file.
int main() //defining main method
{
char i,j; //defining variable
for (i='a'; i<='e'; i++) //outer loop for column
{
for (j='a'; j<='e'; j++) //inner loop for row
{
printf("%c%c\n",i,j); //print value
}
}
return 0;
}
Output:
image.
Explanation:
- In the above C language program, firstly a header file is included. Then the main method is defined in this, a method contains a char variable that is "i and j". This variable is used in for loop, that is used to print the pattern.
- To print the following patter two for loop is used the outer loop is used for print columns and the inner loop prints row.
- In C language to print character, we use "%c" inside a loop print function is used, that prints characters.
I think the answer is C but I could be wrong