Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int poramnet(int a) {
- if(a==0) {
- return 0;
- } else if(a%10==9) {
- return 7+poramnet(a/10)*10;
- }
- return (a%10)+poramnet(a/10)*10;
- }
- void sort(int *a,int n) {
- int i,j;
- for(i=0; i<n-1; i++) {
- for(j=i+1; j<n; j++)
- if(a[i]>a[j]) {
- int temp=a[i];
- a[i]=a[j];
- a[j]=temp;
- }
- }
- }
- int main()
- {
- int niza[100];
- int i=0;
- while(1){
- if(scanf("%d",&niza[i])==0){
- break;
- }
- i++;
- }
- int n=i;
- for(i=0;i<n;i++){
- niza[i]=poramnet(niza[i]);
- }
- sort(niza,n);
- if(n<5) {
- for(i=0; i<n; i++)
- printf("%d ",a[i]);
- } else {
- for(i=0; i<5; i++)
- printf("%d ",niza[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement