Semester Performance Index

 

Write a program to enter the SPI (Semester Performance Index) and get the result in following matter.

If SPI is greater than 7 then Distinction.

If SPI is greater than 6 then First class.

If SPI is greater than 5 then Second class.

If SPI is greater than 4 then First class.

If SPI is less than 3 then Fail.


Source Code:

#include<stdio.h>
#include<conio.h>
void main()
{
	int spi;
	clrscr();
	printf("Enter the SPI:");
	scanf("%d",&spi);

	switch(spi)
	{
		case 10:
		case 9:
		case 8:
		case 7:
			printf("Distinction");
			break;
		case 6:
			printf("First class");
			break;
		case 5:
			printf("Second class");
			break;
		case 4:
			printf("Third class");
			break;
		case 3:
		case 2:
		case 1:
			printf("Fail");
			break;
		default:
			printf("Invalid Choice");
			break;
	}
	getch();
}

Output:

Enter the SPI: 8
Distinction

Leave a Reply

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