Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Sahyadri College of Engineering & Management, Mangaluru

Department of Information Science & Engineering


Mini-Project Report

Course Title : C and C++ Industry Connect Program Date: 10/10/2018 Sem / Section:3/A
Faculty: Mr. Vijay C P & Mr. Srinath K S
Student Name:Likhith R USN:4SF17CS078

Title: Angry Professor

Description:

A Discrete Mathematics professor has a class of students. Frustrated with their lack of discipline, he decides to cancel class if
fewer than some number of students are present when class starts. Arrival times go from on time to arrived late.
Given the arrival time of each student and a threshold number of attendees, determine if the class is canceled.

Input Format:
The first line has two space-separated integers, n and k , the number of students (size of a ) and the cancellation threshold.
The second line contains n space-separated integers stores the arrival time of each student in array.
Output format:
If the class is cancelled then print YES
If the the class is not cancelled then print NO.

Input:
53
0 -1 +5 -3 +2

Expected Output:
NO

Source Code:

//Author: Likhith R
//Date: 10/11/2018
#include<stdio.h>
#include<string.h>
int n,k;
char* angry_professor(int *b)
{
int i,students=0;
for(i=0;i<n;i++)
{
if(b[i]<=0)
{
students=students+1; //calculating number of students
on time and before time
}
}
if(students<k)
{
return "YES";
}
else
{
return "NO";
}
}
void main()
{
int a[10],i;
char *ans;
printf("Enter the number students and cancellation threshold\n");
scanf("%d%d",&n,&k); //reading n,k
printf("Enter the arrival time of the %d students\n",n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
ans=AP(a);
puts(ans);
}

Output:
NO

Student Signature with Date:

You might also like