You're the captain of a pirate ship and would like to calculate whether your trip was a success. You are given two parameters - gold and pirates.
The trip is a success iff there is at least as much gold as pirates. However, if gold + pirates > 100, then the trip is a failure, since the ship may sink. Return true if the ship was a success and false if it was a failure.
Input Format
The gold and pirates are represented using integers. The input line is a space separated integers represents the number of gold and number of pirates
Constraints
No constraints
Output Format
The output line displays either true or false
Sample Input 0
30 10
Sample Output 0
true
Program :
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main()
{
int a,b;
scanf("%d%d",&a,&b);
if(a>=b)
{
printf("true");
}
if(a+b>100)
{
printf("false");
}
else if(a<b)
{
printf("false");
}
return 0;
}
0 Comments