Write a C++ program to sort digits of all the 4 digit number
and display the sorted 4 digit number

Answer Posted / prasadnvk

i=0
while(num>0)
{
digit=num%10;
digitarr[i++]=digit;
num=num/10;

}
then sort the digitarr

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you pass an array to a function in c++?

545


Can I have a reference as a data member of a class? If yes, then how do I initialise it?

708


How do you initialize a string in c++?

565


Write bites in Turbo c++ Header ("Include") Files.

688


How java is different from c and c++?

649






What are iterators in c++?

598


What is a down cast?

613


Why we use #include iostream in c++?

585


What is #include ctype h in c++?

669


Would you rather wait for quicksort, linear search, or bubble sort on a 200000 element array? (Or go to lunch...) a) Quicksort b) Linear Search c) Bubble Sort

641


what is COPY CONSTRUCTOR and what is it used for?

623


Explain what happens when a pointer is deleted twice?

733


What is the precedence when there is a global variable and a local variable in the program with the same name?

639


Describe the advantages of operator overloading?

577


Can a constructor return a value?

575