0% found this document useful (0 votes)
3K views1 page

Write A Program That Will Inputs The Five Digit Number, Separate The Number Into Its Individual Digits and Print The Digits Separated From One Another

The document provides code to input a 5-digit number from the user, separate the number into individual digits, and print each digit spaced 3 spaces apart from the next. It uses integer division and modulus operators to separate each digit, storing them in separate variables, and then prints each variable separated by newlines and spacing.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views1 page

Write A Program That Will Inputs The Five Digit Number, Separate The Number Into Its Individual Digits and Print The Digits Separated From One Another

The document provides code to input a 5-digit number from the user, separate the number into individual digits, and print each digit spaced 3 spaces apart from the next. It uses integer division and modulus operators to separate each digit, storing them in separate variables, and then prints each variable separated by newlines and spacing.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Write a program that will inputs the five digit number, separate the

number into its individual digits and print the digits separated from one
another by three spaces each(Hint: Use the integer division and
modulus operators)
============================================
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
long int no,first,second,third,fourth,fifth;

cout<<"Enter the Five Digit no = ";


cin>>no;

first=no/10000;
no=no%10000;
second=no/1000;
no=no%1000;
third=no/100;
no=no%100;
fourth=no/10;
no=no%10;
fifth=no;

cout<<"\n==================================
============================================
="<<"\n\n\n";

cout<<"First Digit is = "<<first<<"\n\n";


cout<<"Second Digit is = "<<second<<"\n\n";
cout<<"Third Digit is = "<<third<<"\n\n";
cout<<"Fourth Digit is = "<<fourth<<"\n\n";
cout<<"Fifth Digit is = "<<fifth<<"\n\n\n";

cout<<"====================================
============================================"
;
getch();
}

http://www.ravianeducation.blogspot.com
FARHAN: 03008855006

You might also like