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;
- }
- if (a % 10 == 9)
- {
- return 7 + 10 * poramnet(a / 10);
- }
- return a%10 + 10 * poramnet(a / 10);
- }
- int main()
- {
- int a[101], size = 0, temp;
- for (int i = 0; scanf("%d", &(a[i])) == 1; i++)
- {
- a[i] = poramnet(a[i]);
- size++;
- }
- for (int i = 0; i < size; i++)
- {
- for (int j = i + 1; j < size; j++)
- {
- if (a[j] < a[i])
- {
- temp = a[j];
- a[j] = a[i];
- a[i] = temp;
- }
- }
- }
- if (size > 5)
- {
- size = 5;
- }
- for (int i = 0; i < size; i++)
- {
- printf("%d ", a[i]);
- }
- printf("\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement