+ 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
9 ответов
+ 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);
}
+ 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)
+ 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!)
+ 1
Let me try out.
+ 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());
0
Alejandro Cruz show your attempt please...
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.
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);
}
}
}
- 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);
}
}
}