Compile Error
foo.cc:3:3: error: invalid preprocessing directive #Calculate 3 | # Calculate the total cost | ^~~~~~~~~ foo.cc:6:3: error: invalid preprocessing directive #Check 6 | # Check if Sunny can buy 2 kilograms of potatoes | ^~~~~ foo.cc:1:1: error: 'X' does not name a type 1 | X = int(input("Enter the per kilogram cost of potato (X): ")) | ^
Code
X = int(input("Enter the per kilogram cost of potato (X): "))
# Calculate the total cost
TC = X * 2
# Check if Sunny can buy 2 kilograms of potatoes
if TC <= 100:
print("Sunny can buy 2 kilograms of potato.")
else:
print("Sunny cannot buy 2 kilograms of potato.")
Information
- Submit By
- Type
- Submission
- Problem
- P1056 Grown up boy sunny
- Contest
- Brain Booster #3
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-05-06 15:21:18
- Judged At
- 2024-11-11 03:34:37
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes