Pass or Fail

The program must accept a mark and print if it is pass or fail. The pass mark is 40.

Example Input/Output 1:
Input:
40

Output:
pass

Example Input/Output 2:
Input:
32

Output:
fail

Example Input/Output 3:
Input:
55

Output:
pass

Python

mark = int(input())
if mark >= 40:
    print('pass')
else:
    print('fail') 

Java

import java.util.*;
public class Hello {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int mark = sc.nextInt();
        if (mark < 40) {
            System.out.print("fail");
        } else {
            System.out.print("pass");
        }
    }
}

C

#include <stdlib.h>
#include  <stdio.h>
int main()
{
    int mark;
    scanf("%d", &mark);
    if(mark < 40)
    {
        printf("fail");
    }
    else
    {
        printf("pass");
    }
}

C++

#include <iostream>
using namespace std;
int main()
{
    int mark;
    cin >> mark;
    cout << (mark < 40 ? "fail" : "pass");
    return 0;
}
Previous Article

Character - Male or Female

Next Article

Odd or Even

Write a Comment

Leave a Comment

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