Codechef Credit score problem solution

In this Codechef Credit score problem, we have a CRED program. and the access CRED programs, one needs to have a credit score of 750 or more. we have given that the credit score of a man is X. so we need to determine if a man can access the CRED program or not. and if it is possible that a man can access CRED programs then we need to print YES on the output screen otherwise print NO on the output screen.

Let's say a man has a credit score of 850 then we will print YES on the output screen.

codechef credit score problem solution

Problem solution in C programming.

#include <stdio.h>

int main(void) {
  int x;
    scanf("%d",&x);
    if(x>=750)
    printf("YES\n");
    else
    printf("NO\n");	// your code goes here
	return 0;
}


Here in the above code first we declare an integer variable x. and then scan the value of the x as the credit score of a person. and then if the credit score of the person is greater than or equal to the 750 then we print YES on the output screen. otherwise, we will print NO on the output screen.

Problem solution in C++ programming.

#include<iostream>
using namespace std;

int main(){
    int x;
    cin >> x;
    if ( x < 750){
        cout << "NO";
    }
    else{
        cout << "YES";
    }
    
}


Problem solution in Java programming.

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc= new Scanner(System.in);
		int t;
		int x;
	
		    x=sc.nextInt();
		    if(x>=750)
		    System.out.println("yes");
		    else 
		    System.out.println("no");
	}
}


Problem solution in Python programming.

n=int(input())
if n>=750:
    print("Yes")
else:
    print("No")


Here in the above python code we first read an integer input for the number of test cases. and then we check if the value of n is greater than or equal to the 750. means the credit score of a person is greater than or equal to 750. then we print Yes on the output screen otherwise we will print No on the output screen.

Post a Comment

0 Comments