Question Name:Alice Question

#include<iostream>
using namespace std;

int main()
{
  int arr[100],search,i,n;
  n = 10;
  search = 5;
  for(i=0;i<=n;i++)
  {
    cin >> arr[i];
  }
  for(i=0;i<=n;i++)
  {
    if(arr[i] == search)
    {
      cout << "Roll no " << search << " belongs to Ms.Alice Class";
      break;
    }
    if(i == n)
    {
      cout << "Roll no " << search << " not belongs to Ms.Alice Class";
    }
  }
  
}
  • Problem Description

    10 Students have randomly requested to Ms.Alice for subject DS allocated with roll no from 1 to 30 randomly .If Alice want to find roll no:5 belongs to her or not? Help her.

  • Test Case 1

    Input (stdin)

    1 2 3 4 15 6 7 8 9 10
    

    Expected Output

    Roll no 5 not belongs to Ms.Alice Class
  • Test Case 2

    Input (stdin)

    8 4 6 2 7 5 1 6 14 12
    

    Expected Output

    Roll no 5 belongs to Ms.Alice Class

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
CHP Adblock Detector Plugin | Codehelppro