77 474
Assignments Done
Successfully Done
In July 2019

Answer to Question #5560 in C++ for Jimmy

Question #5560
write a c++ programme to print any 10 no given in array in reverse order
Expert's answer
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

int st(int s) //function that raises 10 to a power
{ //of s which is an argument
int val=1;
for (int i=0; i<s; i++)val*=10;
return val;

int main(int argc, char *argv[])
int array[10]; //array to input
string s; //string for reading one integer form the line
int i,j,length; //counters and a variable for string length
for (i=0; i<10; i++)array[i]=0; & //fill the array with nulls
cout<<"Enter 10 integers separated by spaces"<<endl;
for (i=0; i<=9; i++) //cycle for filling the array with 10 integers
& cin>>s; //read one integer
& length=s.length(); & //count its length
& for (j=0; j<length; j++) & //take one digit from integer
& {
array[i]+=int(s[j]-'0')*st(length-1-j); //convert it from char to int,
& } //multiple it to the proper power of 10 and save in array
for (i=9; i>=0; i--)cout<<array[i]<<' '; //output the array in reverse order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


Assignment Expert
15.12.11, 16:34

#include <iostream>
using namespace std;
int main()
int number=0;
& number++;
& if(( number<10)||(number%10==number/10)) cout<<number<<endl;
} while (number!=100);

15.12.11, 08:59

sir kindly help me to this question
c++ program to print all the palindrome between 1 and 100 using do while do

Leave a comment

Ask Your question

Privacy policy Terms and Conditions