Skip to content

Instantly share code, notes, and snippets.

@MaratB
Created September 22, 2013 21:58
Show Gist options
  • Save MaratB/6664276 to your computer and use it in GitHub Desktop.
Save MaratB/6664276 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ctime>
const int N = 10;
main()
{
int i, X, A[N];
int success = 0; // счетчик
srand(time(0));
X=7;
for ( i = 0; i < N; i ++ ){
A[i]=rand()%10;
printf("A[%d]= %d\n", i, A[i]); }
for ( i = 0; i < N; i ++ )
{
if ( A[i] == X )
{
printf ( "Элемент найден A[%d] = %d\n", i, A[i] );
success = 1;
}
}
if (success==0)
printf ( "Элемент %d не найден.", X );
getch();
clock();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment