avatar
Driving Trends: The Standout Cars of Each Automotive Category

Guest 0.9K 11th Feb, 2025

#include<stdio.h>
#include<stdlib.h>
void input(int &nhap){
	printf("nhap so: ");
	scanf("%d", &nhap);
}
void nhapMang(int *array, int length){
	int i;
	for(i = 0; i < length; i++){
		printf("a[%d] ", i + 1);
		input(array[i]);
	}
}
void xuatMang(int *array, int length){
	int temp, i;
	for(i = 0; i < length; i++){
		printf("\n-----------------");
		printf("\n[%d]\t|\t%d", i + 1, array[i]);
	}
}
void insert(int array[], int &n){
	int i, j;
	for(i = 0; i < n; i++){
		if(array[i] % 2 == 1){
			for(j = n; j > i; j--){
				array[j] = array[j - 1];
			}
			array[i + 1] = 0;
			n++;
		}
	}
}
int main(){
	printf("nhap do dai mang...");
	int size;
	input(size);
	int a[100];
	nhapMang(a, size);
	xuatMang(a, size);
	printf("\nProcessing...\n");
	system("pause");
	insert(a, size);
	xuatMang(a, size);
	return 0;
}
Markup
Description

No description

To share this paste please copy this url and send to your friends
RAW Paste Data