Write a program to fill the entire screen with a smiling face. The smiling face has an ASCII value 1.
Write a program to fill the entire screen with a smiling face. The smiling face has an ASCII value 1.
- Get link
- X
- Other Apps
Write a program to find the grace marks for a student using switch. The user should enter the class obtained by the student and the number of subjects he has failed in. Use the following logic: - If the student gets first class and the number of subjects he failed in is greater than 3, then he does not get any grace. If the number of subjects he failed in is less than or equal to 3, then the grace is of 5 marks per subject. - If the student gets second class and the number of subjects he failed in is greater than 2, then he does not get any grace. If the number of subjects he failed in is less than or equal to 2, then the grace is of 4 marks per subject. - If the student gets third class and the number of subjects he failed in is greater than 1, then he does not get any grace. If the number of subjects he failed in is equal to 1, then the grace is of 5 marks per subject.
/*Program to find grace marks of student using switch
Author: Knowledge desk, Date: Decmber10,2020*/
#include<stdio.h>
#include<conio.h>
main()
{
int choice;
clrscr();
printf("\nPress 1 to find grace marks of student in class first.");
printf("\nPress 2 to find grace marks of student in class second.");
printf("\nPress 3 to find grace marks of student in class third.");
printf("\\nPress 4 to exit.");
printf("\n\nEnter a choice :");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\n\nyou has Press 1 to find grace marks of student in class first.");
{
int n;
printf("\nEnter the subjects student has fail :");
scanf("%d",&n);
if(n > 3)
{
printf("\nStudent does not get any gracce marks.");
}
else
{
printf("\nStudent get 5 marks in each studennt .");
}
}
break;
case 2:
printf("\nYou has press 2 to find grace marks of student in class second.");
{
int x;
printf("\nEnter subjects student has fail :");
scanf("%d",&x);
if(x > 2)
{
printf("\nStudent does not get any gracce marks.");
}
else
{
printf("\nStudent get 4 marks in each studennt .");
}
}
break;
case 3:
printf("\nYou has press 3 to find grace marks of student in class second.");
{
int y;
printf("\nEnter subjects student has fail :");
scanf("%d",&y);
if(y > 1)
{
printf("\nStudent does not get any gracce marks.");
}
else
{
printf("\nStudent get 5 marks in each studennt .");
}
}
break;
case 4:
printf("\n You enter 4 to exit ");
exit(0);
break;
default :
printf("\n Please enter a valid number");
}
getch();
return(0);
}
Comments
Post a Comment