Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C Compiler.
- Code, Compile, Run and Debug C program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- //https://otvet.mail.ru/question/228862801
- #include <stdio.h>
- int main()
- {
- int i,j, ost, n, number, size, piter, nicolas, temp;
- n=number=9385721;
- i=piter = nicolas =0;
- while(number)//count how many cifr there is in number
- number/=10, i++;
- size = i;
- number = n;
- i=0;
- printf("there is %d cirf in number\n",size);
- int arr[size];
- for(i=0;i<size;i++)//fill array with cifrs
- arr[i] = number%10, number/=10;
- for(i=0;i<size;i++)//print an array
- printf("%d\n",arr[i]);
- for(i=0;i<size;i++)//sort an array
- {
- for(j=i+1;j<size;j++)
- {
- if(arr[i]>arr[j])//swap
- {
- temp = arr[i];
- arr[i] = arr[j];
- arr[j]= temp;
- }
- }
- }
- for(i=0;i<size;i++)//print an array
- printf("%d\n",arr[i]);
- return 0;
- }
Add Comment
Please, Sign In to add comment