View Code of Problem 76

#include<stdlib.h>
#include<stdio.h>

int main(){
	int num[10]={0};
	for(int i=0; i<9; i++)
		scanf("%d",&num[i]);
	int x,index=9;
	scanf("%d",&x);
	for(int i=0; i<9; i++){
		if(num[i]>x){
			index = i;
			break;
		}
			
	}
	for(int i=9; i>index; i--)
		num[i] = num[i-1];
	num[index] = x;
	for(int i=0; i<=9; i++)
		printf("%d\n",num[i]);

	return 0;
}

Double click to view unformatted code.


Back to problem 76