the number 138 is called well ordered number because the
three digits in the number (1,3,8) increase from left to right
(1<3<8). the number 365 is not well ordered coz 6 is larger
than 5.
write a program that wull find and display all possible
three digit well ordered numbers.

sample:
123,124,125,126,127,128,129,134
,135,136,137,138,139,145,146,147
148
149,156.......789

Answers were Sorted based on User's Feedback



the number 138 is called well ordered number because the three digits in the number (1,3,8) increas..

Answer / sm1

#include<stdio.h>
int main(){
int i,j,k;
for (i=1; i<8; i++)
for (j=i+1; j<9; j++)
for (k=j+1; k< 10; k++)
printf("%d\n", i*100+j*10+k);
}

Is This Answer Correct ?    19 Yes 12 No

the number 138 is called well ordered number because the three digits in the number (1,3,8) increas..

Answer / ankit kamboj

#include<stdio.h>
main()
{
int i,j,n,a,n1,cnt=0;;

int arr[3];
for(n=100;n<=999;n++)
{ n1=n;
for(i=2;i>=0,n1>0;i--,n1=n1/10)
{ a=n1%10;
arr[i]=a;
}

for(i=0;i<3;i++)
printf("%d ",arr[i]);

if(arr[0]<arr[1] && arr[1]<arr[2])
{printf("It is well ordered \n"); cnt++;}
else
printf("It is not well order\n");

}
printf("The n0. of well ordered no. are %d\n",cnt);
}

Is This Answer Correct ?    6 Yes 2 No

the number 138 is called well ordered number because the three digits in the number (1,3,8) increas..

Answer / karthick_int

#include<stdio.h>
void main()
{
int n,i,j,k,m;
clrscr();
printf("Entr d no:");
scanf("%d",&n);
i=n%10;j=n/10;
k=j%10;m=j/10;
printf("The values are:%d\t%d\t%d\t",i,k,m);
if((i>k)&&(i>m))
{
if(k>m)
{
printf("Well ordered");
}
}
else
{
printf("not");
}
getch();
}

Is This Answer Correct ?    7 Yes 6 No

the number 138 is called well ordered number because the three digits in the number (1,3,8) increas..

Answer / santosh kumar

for(int i=0;i<8;i++)
for(int j=i+1;j<9;j++)
for(int k=j+1;k<10;k++)
printf("%d\t", i*100+j*10+k);

Is This Answer Correct ?    7 Yes 15 No

the number 138 is called well ordered number because the three digits in the number (1,3,8) increas..

Answer / goloap

for (int i=1; i<8; i++)
for (int j=i; j<9; j++)
for (int k=j; k< 10; k++)
printf("%d\n", i*100+j*10+k);

Is This Answer Correct ?    6 Yes 18 No

Post New Answer

More C Interview Questions

Why is conio.h not required when we save a file as .c and use clrscr() or getch() ?

2 Answers  


WHO WROTE C LANGUAGE?

4 Answers  


in one file global variable int i; is declared as static. In another file it is extern int i=100; Is this valid ?

4 Answers   Infosys, NetApp,


what is the output of below int n=10; (n++)++; printf("%d",n);

3 Answers  


Which is better between malloc and calloc?

0 Answers  






Write a function that accepts two numbers,say a and b and makes bth bit of a to 0.No other bits of a should get changed.

2 Answers   Scientific Atlanta, Wipro,


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

0 Answers   Subex,


Struct(s) { int a; long b; } Union (u) {int a; long b; } Print sizeof(s)and sizeof(u) if sizeof(int)=4 and sizeof(long)=4

2 Answers   Mascot,


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

0 Answers   Aspiring Minds,


wtite a program that will multiply two integers in recursion function

4 Answers   TCS,


What is a newline escape sequence?

0 Answers  


What is wild pointer in c?

0 Answers  


Categories