Meera wrote SBI PO exam and was waiting for her result. After a week, SBI released the results on its website. On the website, she needs to click the results after that she will get a pdf. In that pdf, test passed candidate register numbers are displayed. Then, Meera has to check whether her register number is there or not. If her register number is found, then she has passed her exam. Otherwise, she failed.
Answers
Answered by
13
#include<iostream>
using namespace std;
int main()
{
int n,arr[15],i,a,flag=0;
cin>>n;
for(i=0;i<n;i++){
cin>>arr[i];
}
cin>>a;
for(i=0;i<n;i++){
if(arr[i]==a){
flag=1;
break;
}
}
if(flag==1)
cout<<"She passed her exam";
else
cout<<"She failed";
return 0;
}
/*
6
34 56 78 98 23
45
Output (stdout)
She failed
*/
Answered by
3
Answer:
#include<iostream>
using namespace std;
int main()
{
int n,i,a,flag=0;
cin>>n;
int arr[n];
for(i=0;i<n;i++){
std::cin>>arr[i];
}
std::cin>>a;
for(i=0;i<n;i++){
if(arr[i]==a){
flag=1;
break;
}
}
(flag==1)?std::cout<<"She passed her exam":std::cout<<"She failed";
return 0;
}
Explanation:
Similar questions