77 413
Assignments Done
Successfully Done
In July 2019

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
using namespace std;

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

void main(){
cout<<"enter a five-digit integer: ";
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";

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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions