- 7
Question about Array
Create an array of size 7 and assign 3,6,8,12,141,15,17 values to array and then take input from user to search the value in array. Letâs say if user enters 8 so program should display that value 8 is present in array else if user enters value 1 so it should display that value 1 does not exist in array.
4 Answers
+ 1
Show your attempt
+ 1
I think so sharing your phone number is against the rule of Sololearn. Be careful about it next time
0
C
#include<studio.h>
int main()
{
Int a[7],I, count=0,k;
for(I=0;I<7;I++){
Scanf("%d",&a[I]);}
scanf("%d",&k);
for(I=0;I<7;I++){
if(a[I] == k){
count++;}
}
if(count >0)
{
printf("%d\t exist in array",k);}
else{
printf("%d\t does not exist in array",k);
}
}
Hope it is helpful đ
- 6
Plz Send me on WhatsApp if Someone Solve this Program. +923022500993