+ 3

C# 9.3 Beer Party not working

I PLACE INT x = 30%7; AnD IT WoRKS FOR THAT BUT IT DOESNT WoRK FOR THE OtHER TEST ON THE SAME PrACTICE. ITS NOT AUTO SWAPPING THE 30 FoR THE OtHER TEST NUMBERS LIKE IT DOES ON THE OtHEr PRACTICE WoRK

4th Jan 2021, 4:02 AM
Alejandro Cruz
9 Réponses
+ 4
It says that you assigned x as an integer that makes 30 divided by 7 remaining 2 but you need someone to input an integer to divide 7 making remaining other numbers: Demo: public static void Main(string[] args) { string d; int e; int x; Console.WriteLine(""); d = Console.ReadLine(); e = Convert.ToInt32(d); x = e%7; Console.WriteLine(x); }
4th Jan 2021, 5:00 AM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
+ 1
I ran the code you show it and it says that you need to define the main method as: public static void main(String[] args)
4th Jan 2021, 4:29 AM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
+ 1
where do i go to look at the error? I ran that with public and it still only worked for one answer Dino Wun (Use the search bar plz!)
4th Jan 2021, 4:40 AM
Alejandro Cruz
+ 1
Let me try out.
4th Jan 2021, 4:41 AM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
+ 1
You need to take the beer bottles as an input (in this case 30) If you don't remember how to take and convert input from the user, here's an example. int beer = Convert.ToInt32(Console.ReadLine());
19th Feb 2022, 2:04 PM
SevenPRD
SevenPRD - avatar
0
Alejandro Cruz show your attempt please...
4th Jan 2021, 4:26 AM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
0
Hello Dino, I agree with Alejandro. that public static stuff is not covered in any of the beginner material. Sorry, but completely confused by how you got this solution. it does work though. I wish i could understand it. the second answer you placed using System; does not seem to work.
21st Jan 2021, 5:02 PM
Eman Laer
0
using System; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { int a; a = Convert.ToInt32 (Console.ReadLine()); int x = a % 7; Console.WriteLine(x); } } }
21st Mar 2021, 11:41 PM
Sebastian Górski
Sebastian Górski - avatar
- 1
Dino Wun (Use the search bar plz!) 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 x = 30%7; Console.WriteLine(x); } } }
4th Jan 2021, 4:27 AM
Alejandro Cruz