#include
/* In case pow does not work from math.h */
int my_pow( int x, int y )
{
int i, result = 1;
for( i=1; i<=y; i++ )
{
result = result * x;
}
return result;
}
int main()
{
int n,i,j, temp1, temp2;
printf("\n Enter number of digits :");
scanf("%d",&n);
for( i= my_pow(10,n-1); i < (my_pow(10,n)-1); i++ )
{
j = n;
do
{
temp1 = ( i / (my_pow(10,(n-j))) ); /* Formula to fetch successive digit */
temp1 = temp1%10;
temp2 = ( i / (my_pow(10, (n-(j-1)))) ); /* Formula to fetch successive digit */
temp2 = temp2%10;
if ( temp1 > temp2 )
{
if ( 1 == j )
{
printf(" %d, ", i );
break;
}
j--;
}
else
{
break;
}
}while(1);
}
printf("\n");
return 1;
}
OUTPUT:
------------
[~/temp-satish]$ ./a.out
Enter number of digits :2
12, 13, 14, 15, 16, 17, 18, 19, 23, 24, 25, 26, 27, 28, 29, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 56, 57, 58, 59, 67, 68, 69, 78, 79, 89,
[~/temp-satish]$
[~/temp-satish]$ ./a.out
Enter number of digits :3
123, 124, 125, 126, 127, 128, 129, 134, 135, 136, 137, 138, 139, 145, 146, 147, 148, 149, 156, 157, 158, 159, 167, 168, 169, 178, 179, 189, 234, 235, 236, 237, 238, 239, 245, 246, 247, 248, 249, 256, 257, 258, 259, 267, 268, 269, 278, 279, 289, 345, 346, 347, 348, 349, 356, 357, 358, 359, 367, 368, 369, 378, 379, 389, 456, 457, 458, 459, 467, 468, 469, 478, 479, 489, 567, 568, 569, 578, 579, 589, 678, 679, 689, 789,
[~/temp-satish]$ ./a.out
Enter number of digits :4
1234, 1235, 1236, 1237, 1238, 1239, 1245, 1246, 1247, 1248, 1249, 1256, 1257, 1258, 1259, 1267, 1268, 1269, 1278, 1279, 1289, 1345, 1346, 1347, 1348, 1349, 1356, 1357, 1358, 1359, 1367, 1368, 1369, 1378, 1379, 1389, 1456, 1457, 1458, 1459, 1467, 1468, 1469, 1478, 1479, 1489, 1567, 1568, 1569, 1578, 1579, 1589, 1678, 1679, 1689, 1789, 2345, 2346, 2347, 2348, 2349, 2356, 2357, 2358, 2359, 2367, 2368, 2369, 2378, 2379, 2389, 2456, 2457, 2458, 2459, 2467, 2468, 2469, 2478, 2479, 2489, 2567, 2568, 2569, 2578, 2579, 2589, 2678, 2679, 2689, 2789, 3456, 3457, 3458, 3459, 3467, 3468, 3469, 3478, 3479, 3489, 3567, 3568, 3569, 3578, 3579, 3589, 3678, 3679, 3689, 3789, 4567, 4568, 4569, 4578, 4579, 4589, 4678, 4679, 4689, 4789, 5678, 5679, 5689, 5789, 6789,
[~/temp-satish]$
Data organized in ascending or descending order is called stacking data. Stacking data is usually organized by number or by alphabet.
public static void main(String[] args) { int val = 100; int val1 = 50; System.out.println("Number of digits in " + val + " is: " + new String(val + "").length()); System.out.println("Number of digits in " + val1 + " is: " + new String(val1 + "").length()); }
Ascending means to increase or rise. You can ascend stairs, for example, by climbing them. a pattern of numbers can be ascending if each number increases, such as 1, 2, 3, 4, 5.Ascending is used to describe the return of Jesus from earth to heaven after his resurrection.ok thanks!!Going upwards. In different contexts it could mean increasing, getting bigger or climbing.
Well There is no "functions"but there is a way:#include main(){int n,num;printf("Enter Number");scanf("%d",n);num = n%2;if(n==1){printf("Your number is Odd");}else{printf("Your number is Even");}return 0;}
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.
An Ascending # is a # That Is Getting Larger. A Descending # is a # That Is Getting Smaller.
307900 ascending 307898 descending
The number is: 36725918 In descending order that is: 98765321 The pairs of numbers that have as many digits between them in both are: 3,9 5,8 6,7 So there are three pairs.
1
order ascending or descending and take the 6th number
In any way that you like, provided that you define the rule clearly. For examples, number is ascending order, in descending order, by their fractional parts (ascending or descending), by their remainder when divided by some other number, and so on.
None.
Placing the smallest digit at the top and listing so the digits continue down to the largest number is to sort in ascending order, from, for example, 1 to 10.To place the numbers with the largest at the top and the smallest at the bottom is to sort in descending order, say from 10 to 1.These terms also apply to other sorted data, so a column of words, for example, might be sorted alphabetically in either ascending or descending order, with the first letters listed from A to Z, or from Z to A.
999 (whole) numbers. THere are the same number whether they are counted in ascending, descending or other order.
None of them. The digits, arranged in descending order, are: 97654321 9 is 1 digit from the start 7 is 2 digit from the start etc So none.
Ascending means going up. 1, 2, 3, 4, 5 are ascending numbers. 5, 4, 3, 2, 1 are descending numbers.
In descending order from highest to lowest