+ 1
Skee ball
Where I'm making mistake Some test result are correct some wrong why https://code.sololearn.com/cDzxe6JYBX98/?ref=app
6 Antworten
+ 8
Lalala ,
there are 2 issues in the code. please read the task description carefully.
#include <iostream>
using namespace std;
int main(){
int points ;
int SquirtGun ;
cin >> points;
cin >> SquirtGun ;
//if ( SquirtGun < points ){ // >>> logic not correct
if ( SquirtGun <= (points /12)) {
cout << "Buy it!" ;
//return 0; // >>> not required
}
//else ( SquirtGun > points ); // >>> else clause can not have a condition
else
{
cout << "Try again" ;
}
return 0;
}
+ 1
You will get points as input, not tickets 😉
And you will it not only buy if the price is less your tickets, but also if it is equal.
+ 1
Lalala your code produce the expected output for some cases. But this result is by random, and based on your generally wrong code.
1. Take points as input.
2. Calculate the number of tickets for this points.
3. Compare the price with the tickets, and buy if it's less or equal.
+ 1
Coding Santa oooow I missed that point about 12 thanx
0
Coding Santa man when it inputs 100 50 İst wrong
Bu it inputs 10000 600 it works and it's just idk why
0
#include <stdio.h>
int main() {
float points;
scanf("%f",&points);
points/=12;
if(points>39)
printf("Buy it!");
else
printf("Try again");
}
Where is the mistake ???