Computer Science, asked by dharmbeersingh0, 3 months ago

write a c program to Take 10 integer inputs from user and store them in an array. Again ask user to give a number. Now, tell user whether that number is present in array or not.

Answers

Answered by subgb98
2

Answer:

This program is suitable for turbo c++.

#include<stdio.h>

#include<conio.h>

void main()

{

int n,number;

clrscr();

scanf("%d",&n);

int array[n];

for(int i=0;i<n;i++)

scanf("%d",&array[i]);

printf("Enter the number  \n");

scanf("%d",&number);

for(int i=0;i<n;i++)

{

if(number==array[i])

{printf("Yes your number is present\n");

break;

}

getch();

}

Answered by umar94609
1

Answer:

#include<iostream>

using namespace std;

int main()

{

int my[3];

for(int i=0;i<3;i++)

cin>>my[i];

for(int i=0;i<3;i++)

cout<<my[i];

cout<<endl;

int n;

cout<<"Enter a number: ";

cin>>n;

for(int i=0;i<n;i++)

{

if(n==my[i])

cout<<"Yes your number is present\n";

}

return 0;

}

Explanation:

Run and execute to check results

Similar questions