Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
569 views
in Importing C++ Programs in Python by (49.1k points)
closed by

Write a C++ program to check whether the given number is palindrome or not. Write a program to execute it?

Write a C++ program to enter any number and check whether the number is palindrome or not using while loop?

1 Answer

+1 vote
by (54.8k points)
selected by
 
Best answer

//Now select File-> New in Notepad and type the C++ program

#include<iostream>

using namespace std;

intmain( )

{

int a[3][3], i, j;

for(i=o; j<3;i++)

{

for(j=0;j<3;j++)

{count<<“enter the value for array [”<<i + 1<<"] <<"<<"["<<j + 1 <<"]";

cin>>a[i][j];

}

}

system(“cls”); .

cout<<“\n \nOriginal Array\n”;

for(i=0; i<3; i++)

{

for(j=0; j<3; j++)

cout<<a[i] [j]

cout<<end1;

}

return 0;

}

// Save this file as trans_cpp.cpp

// Now select File → New in Notepad and type the Python program

#Save the File as transpose.py.Program that compiles and executes a .cpp file

#Python tanspose.py -i trans_cpp

import sys, os, getopt

def main(argv):

cpp_file ="

exefile = ”

opts, args = getopt.getopt(argv, “i:” ,[‘ifile= ’])

for o, a in opts:

if o in (“-i” ,–ifile”):

cpp_file =a+ ‘.cpp’

exe_file = a+ ‘.exe’

run(cpp_file, exe_file)

def run(cpp_file, exe file): 

print(“Compiling” + cppfile)

os.system(‘g++’ + cpp_file + ‘-o ‘+ exe_file) 

print(“Running” + exefile)

print(“.........")

print

os.system(exe_file)

print 

if_name_== ’_main_’:

main(sys.argv[1:])

Output of the above program

Original Array

1 2 3

4 5 6

7 8 9

The Transpose of Matrix

1 4 7

2 5 8

3 6 9

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

...