Problem 09

author
By Supreme2023-02-23
Problem Statement :
Write a program to read marks of a student from keyboard whether the student is pass or fail(using if else)
Code:

#include <stdio.h>

int main()
{

// 9. Write a program to read marks of a student from keyboard whether the student is pass
// or fail(using if else)

printf("\tCheck Pass Or Fail");
printf("\n=================================");

float marks;

printf("\n\nEnter your Marks : ");
scanf("%f", &marks);

printf("\n_________________________________\n");

if (marks >= 33)
{
printf("\nCongratulations You Are Passed......");
}

else
{
printf("\nOoops..You Are failed!!!!!!!!!");
}

printf("\n_________________________________\n\n");
return 0;
}

Description :
  • This C program reads the marks obtained by a student and checks whether the student has passed or failed based on the minimum passing marks criteria of 33%.
  • The program first prints some messages to prompt the user to enter their marks. It then takes the input from the user using the scanf function.
  • The program then checks the value of the input marks using an if-else statement. If the marks are greater than or equal to 33, it prints "Congratulations You Are Passed......". Otherwise, it prints "Ooops..You Are failed!!!!!!!!!"
  • Finally, the program prints some more messages and returns 0 to indicate successful completion of the program.
Output Image:
Output-image

© Copyright 2022. All right reserved, GTU Coder.