Computer Science, asked by priya1068, 8 months ago

WAP to input ten integers and check whether the entered numbers air in ascending order or not

Answers

Answered by khushboo8267
0

Answer:

Here is yur answer

Explanation:

include <stdio.h>

int main()

{

int x, y, i, total = 0;

printf("\nInput a pair of numbers (for example 10,2 : 2,10):");

printf("\nInput first number of the pair: ");

scanf("%d", &x);

printf("\nInput second number of the pair: ");

scanf("%d", &y);

if (x>y)

{

printf("The pair is in descending order!");

}

else

{printf("The pair is in ascending order!");

}

printf("\n");

Hope it helps yu

Answered by duragpalsingh
0

Question:

Write a program to input an integer and check whether al digits are in ascending order or not.

Solution:

Language used: Java

import java.util.*;

public class Question45

{

static void main()

{

Scanner sc=new Scanner(System.in);

int d1,d2,n,f=0;

System.out.println("Enter an integer:");

n=sc.nextInt();

while(n>9)

{

d2=n%10;

d1=(n/10)%10;

if(d1>d2)

f=1;

n=n/10;

}

if(f==0)

System.out.println("All digits are in ascending order");

else

System.out.println("All digits are not in ascending order");

}

}

Similar questions