Type the Question

Saturday, February 16, 2019

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

No comments:

Post a Comment

Question Name:TOWER OF HANOI

#include < bits / stdc ++. h > #define lli long long using namespace std ; lli dp [ 202 ]; int main () { int t , n ; ...