Seat Allocation I

Seat Allocation I

The seats are arranged in the lab in a rectangular fashion with m rows and n columns. The students are seated in the lab according to their roll numbers in rowwise order, starting from 1.
Given the roll number of a student, find whether the student is seated in the first row or in the 1st or last column.

Input and Output Format:
Refer sample input and output.
The output consists of a string --- “yes” or “no”.

All text in bold corresponds to input and the rest corresponds to output.
Sample Input and Output 1:
Enter the number of rows
5
Enter the number of columns
10
Enter the roll number of the student
41
yes


Sample Input and Output 2:
Enter the number of rows
5
Enter the number of columns
10
Enter the roll number of the student
42
no

Image result for Seat Allocation


#include < stdio.h >

int main()
{
int a,b,c;
printf("Enter the number of rows\n");
scanf("%d",&a);
printf("Enter the number of columns\n");
scanf("%d",&b);
printf("Enter the roll number of the student\n");
scanf("%d",&c);
if(c < =b||c%b==1||c%b==0)
{
printf("yes");
}
else
{
printf("no");
}
return 0;
}

1 comment:

  1. RTPS The RTPS Centre at Bihar Bhawan was officially opened by the Hon’ble Chief Minister Bihar on 15 Aug 2012 to be a place to collect the Caste, Income, and Residential Certificates.
    factorial hundred In the last few days, the “factorial of 100” is one of the top subjects and a lot of maths geeks compute it using voice assistants such as Alexa, Shiri, etc.
    In the last few days, the “factorial of 100” is one of the top subjects and a lot of maths geeks compute it using voice assistants such as Alexa, Shiri, etc.
    cciv-stock Stocks rose on Friday after news of Churchill Capital’s (NYSE:CCIV) Special Purpose Acquisition Company (SPAC) closing its merger with Lucid Motors.

    ReplyDelete