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

a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

0 Answers  


Is stack a keyword in c?

0 Answers  


fun(int x) { if(x > 0) fun(x/2); printf("%d", x); } above function is called as: fun(10); what will it print? }

17 Answers   NDS,


What is difference between stdio h and conio h?

0 Answers  


main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none

0 Answers  






how could explain about job profile

0 Answers  


what is develop in c language

2 Answers  


Who is the founder of c language?

0 Answers  


write a c program to calculate the income tax of the employees in an organization where the conditions are given as. (I.T. = 0 if income <100000 I.T = 10% if income _< 200000 it = 20% if income >_ 200000)

7 Answers   Consultancy, DBU, FD, JK Associates, Kobe, Satyam,


int i=0,j; j=++i + ++i ++i; printf(" %d",j);

2 Answers   ME,


I came across some code that puts a (void) cast before each call to printf. Why?

0 Answers  


what is the use of call back function in c?tell me with example

2 Answers   Bosch,


Categories