- 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.

22nd Jan 2021, 7:07 AM
zubair afridi
zubair afridi - avatar
4 Answers
+ 1
Show your attempt
22nd Jan 2021, 7:14 AM
Atul [Inactive]
+ 1
I think so sharing your phone number is against the rule of Sololearn. Be careful about it next time
22nd Jan 2021, 7:15 AM
Atul [Inactive]
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 😊
22nd Jan 2021, 10:46 AM
Surkhab Khan
Surkhab Khan - avatar
- 6
Plz Send me on WhatsApp if Someone Solve this Program. +923022500993
22nd Jan 2021, 7:08 AM
zubair afridi
zubair afridi - avatar