Why error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why error?

You are organizing a party for 7 guests. They all love beer. Write a program that receives the number of bottles you bought as input and calculates how many bottles are left after all guests have received an equal number of bottles. Sample input thirty Result example 2

24th Feb 2021, 8:03 AM
SammE
SammE - avatar
2 Answers
+ 6
They are 7 guests not 8. We have to use '%' operator to get the reminder
24th Feb 2021, 8:10 AM
Simba
Simba - avatar
+ 2
Attempt: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { int kol = Convert.ToInt32(Console.ReadLine()); int res = kol /= 8; Console.WriteLine(res); } } }
24th Feb 2021, 8:04 AM
SammE
SammE - avatar