Passed of Failed Program in C++ || Conditional Statements || C++ || Turbo C++
In this we are going to see how to make a Program in C++ which checks whether the Student is Passed or Failed.

The code given below can be used for TURBO C++ Compiler:-

#include<iostream.h>
#include<conio.h>

void main()
{
        clrscr();
	float a;
	cout<<"Enter your percentage"<<endl;
	cin>>a;
	if(a<35)
	{
		cout<<"You failed in exam!!!! please apply for re-exam \n";
	}
	else if(a>=35)
	{
		cout<<"Congrats you passed the exam \n";
	}
	getch();
}
    
    

The code given below can be used for g++/gcc Compiler:-

#include<iostream>
using namespace std;

int main()
{
	float a;
	cout<<"Enter your percentage"<<endl;
	cin>>a;
	if(a<35)
	{
		cout<<"You failed in exam!!!! please apply for re-exam \n";
	}
	else if(a>=35)
	{
		cout<<"Congrats you passed the exam \n";
	}
	return 0;
}
    
    

#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post