Codechef Problems: Cloud Watching (CWCTH)

 Problem Statement: 


Solution: 

Given, 
    A : number of clouds in morning 
    B : number of clouds in evening 

condition: rain if A is at least three times B otherwise it will be dry 

so solution 

condition 1: if A >= 3 * B
output: Rain 

condition 2: otherwise 
output: Dry 

Code Solution: 

#include <bits/stdc++.h>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;

    if (b >= 3 * a) {
        cout << "Rain" << endl;
    } else {
        cout << "Dry" << endl;
    }

    return 0;
}

Comments

Popular Posts