Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // указатели.cpp : Defines the entry point for the console application.
- //
- #define _CRT_SECURE_NO_WARNINGS
- #include <conio.h>
- #include <stdlib.h>
- #include <stdio.h>
- int main() {
- int n = 0, min, i, j = 0;
- printf("Enter n : ");
- scanf("%d", &n);
- int *a = new int[n];
- printf("Enter array : ");
- for (i = 0; i < n; i++)
- scanf("%d", &a[i]);
- printf("\n");
- min = a[0];
- for (i = 0; i < n; i++)
- {
- if (a[i] < min) min = a[i], j = i;
- }
- printf("a[%d]=%d - min", j, min);
- printf("\n");
- for (i = 0; i < n; i++)
- if (i > j) a[i] = 0;
- printf("\n");
- for (i = 0; i < n; i++)
- printf("%d ", a[i]);
- delete[] a;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement