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 the difference between #import and #include?
Write a c program for binary addition of two 8 bit numbers.
What is c++ iterator?
Which bit wise operator is suitable for turning off a particular bit in a number?
Can the creation of operator** is allowed to perform the to-the-power-of operations?
How many types of modularization are there in c++?
What is abstraction in c++?
Give example of a pure virtual function in c++?
Explain overriding.
What is the full form of c++?
What should main() return in c and c++?
What is auto type c++?
What is difference between n and endl in c++?
What are the various compound assignment operators in c++?
What are built-in functions? What is the syntax for the definition?