68 240
Assignments Done
99%
Successfully Done
In November 2018

Answer to Question #16323 in C++ for Tahreem virk

Question #16323
Write a program that inputs a five-digit integer, separates the integer
into its digits and prints them separated by three spaces each. For example, if the user types in 42339, the program
should print:
4 2 3 3 9
Expert's answer
#include<iostream>
using namespace std;

int i, a, b, c, d, e;

void main(){
cout<<"enter a five-digit integer: ";
cin>>i;
e = i%10;
d = ((i-e)/10)%10;
c = (((i-e)/10-d)/10)%10;
b = ((((i-e)/10-d)/10-c)/10)%10;
a = (((((i-e)/10-d)/10-c)/10-b)/10)%10;
cout<<a<<" quot;<<b<<" quot;<<c<<" quot;<<d<<" quot;<<e<<"\n";
system("pause");
}

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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions