View Code of Problem 76

#include <stdio.h>
#include <math.h>
void main() 
{
	int a[10], n, index = 9;
	for (int i = 0; i < 9; i++)
	{
		scanf("%d", &a[i]);
	}
	scanf("%d", &n);
	for (int i = 0; i < 9; i++)
	{
		if (a[i] > n)
		{
			index = i;
			break;
		}
	}
	for (int i = 9; i > index; i--)
	{
		a[i] = a[i - 1];
	}
	a[index] = n;
	for (int i = 0; i < 10; i++)
	{
		printf("%d\n", a[i]);
	}
}

Double click to view unformatted code.


Back to problem 76