Write a programme which arrange three digit number in ascending order? in C language

Let’s under stand some concept

If you enter three digit to arrange into ascending order then you have to under stand the some concept of permutations and combination (according to permutations and combination). ” three digit number can arrange in six possible digit number” so, you have write six line for make number and six line to compare number to another.

Example– if you take number likes 123

123, 132, 312, 321, 213, 231 that’s a possible number.

Some sign are used like

  • () small bracket
  • && use for ‘and’ use for address
  • {} curly bracket
  • “” double code
  • #inclide<studio.h>
  • #include<conio.h>
  • void main()
  • {
  • Int var, a, b, c, d, e, f, g, h, I, j;
  • Clrscr();
  • Printf(“enter the three digit number to convert into ascending order” );
  • Scanf(“%d”, &var);
  • a=var/100;
  • b=var%100;
  • c=b/10;
  • d=b%10;
  • e=a*100+c*10+d;
  • f=c*100+a*10+d;
  • g=c*100+d*10+a;
  • h=d*100+c*10+a;
  • i=d*100+a*10+c;
  • j=a*100+d*10+c;
  • If(e>f&&e>g&&e>h&&e>i&&e>j)
  • {
  • printf(“larger=%d”, e);
  • }
  • else if(f>e&&f>g&&f>h&&f>i&&f>j)
  • {
  • Printf(“larger=%d”, f);
  • }
  • If(g>e&&g>f&&g>h&&g>i&&g>j)
  • {
  • printf(“larger=%d”,g);
  • }
  • else if(h>e&&h>f&&h>g&&h>i&&h>j)
  • {
  • printf(“larger=%d”, h);
  • }
  • If(i>e&&i>f&&i>g&&i>h&&i>j)
  • {
  • Printf(“larger=%d”,i);
  • }
  • else if(j>e&&j>f&&j>g&&j>h&&j>i)
  • {
  • printf(“larger=%d”, j);
  • }
  • getch();
  • }

Input Output or result….

If you enter any number to arrange any number in ascending order. Then result are given below.example 123

Results. 321

For any other help you can follow us on Twitter, Facebook, Instagram…. Today world.

4 Replies to “Write a programme which arrange three digit number in ascending order? in C language”

Leave a reply to Today world Cancel reply

Design a site like this with WordPress.com
Get started