Write a program and call it sortcheck.cpp which receives 10 numbers from input and checks whether these numbers are in ascending order or not. You are not allowed to use arrays. You should not define more than three variables
Answer Posted / jobbine joseph
int main()
{
int Reading_num,Previou_num=-999999,i=0;
for(i=0;i<10;i++)
{
cin>>Reading_num;
if(Reading_num < Previous_num)
{
break;
}
Previous_num = Reading_num;
}
if(i<10)
{
cout<<"Numbers are Not in ASCENDING";
}
else
{
cout<<"Numbers are in ASCENDING ";
}
return(0);
}
| Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
What is oops in c++?
Is map ordered c++?
Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator.
What will strcmp("Astring", "Astring"); return a) A positive value b) A negative value c) Zero
What does namespace mean in c++?
How long does it take to get good at leetcode?
Write a struct time where integer m, h, s are its members?
What do you mean by ‘void’ return type?
Does c++ have string data type?
Where do I find the current c or c++ standard documents?
Explain the difference between new() and malloc() in c++?
What are special characters c++?
What is c++ array?
Explain the difference between static and dynamic binding of functions?
an operation between an integer and real always yeilds a) integer result b) real result c) float result