0

In sololearn I have to scan the 2 different integers ...but I can't..then what will be the proper way?

7th Apr 2020, 7:31 AM
Vaishnavi Pawar
Vaishnavi Pawar - avatar
4 ответов
0
How you tried? Can we see it ?
7th Apr 2020, 7:35 AM
Jayakrishna 🇮🇳
7th Apr 2020, 8:01 AM
Vaishnavi Pawar
Vaishnavi Pawar - avatar
0
In this code,1st I scanned an array..it's scanning and printing properly..but next time I have to scan a number only...but num is not scanning properly..is there any mistake..while scanning?
7th Apr 2020, 8:04 AM
Vaishnavi Pawar
Vaishnavi Pawar - avatar
0
What do you mean by scanning? Searching? Do you want to display 2nd entered number is in array or not? Vaishnavi Pawar if yes, try this way.. In your program, just entering 7 number into array and in next loop displaying those numbers... And to search the input taken value num is in array or not, use if block in loop like this... bool b=false; //take int b=0; for(int i=0;i<7;i++) { if(a[i] ==num){ b=true; //or b=1 break; } if(b) printf("%d Number is in array" num); else printf("%d not in array", num);
7th Apr 2020, 11:04 AM
Jayakrishna 🇮🇳