C
C#12mo ago
lg

how do I make a program?

Hello, how do I make a program that outputs "Yes" or "No" depending on whether there are 3 words in the entered words that should output "Yes"?
10 Replies
SinFluxx
SinFluxx12mo ago
I think this probably needs a bit more detail on what it is you're trying to do / what you've done so far $details
MODiX
MODiX12mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
lg
lgOP12mo ago
Condition You have learned the recipe for a delicious cake: flour, sugar and milk. Every delicious cake should contain these three ingredients. You get 5 ingredients at the entrance, find out if the cake will be delicious or not. The input data format is 5 words – the names of the cake ingredients. Output data format The answer is YES if the cake is delicious, or NO if the cake is tasteless.
SinFluxx
SinFluxx12mo ago
Cool, and what have you managed to do so far?
lg
lgOP12mo ago
Not much
SinFluxx
SinFluxx12mo ago
you can paste it here with $code
MODiX
MODiX12mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat For longer snippets, use: https://paste.mod.gg/
lg
lgOP12mo ago
using System;

namespace Interview
{
class Program
{
static void Main(string[] args)
{
string a = Console.ReadLine();
string b = Console.ReadLine();
string c = Console.ReadLine();
string d = Console.ReadLine();
string e = Console.ReadLine();
if ((e == "мука" || e == "сахар" || e == "молоко")&&(d == "мука" || d == "сахар" || d == "молоко")&&(c == "мука" || c == "сахар" || c == "молоко")&&(a == "мука" || a == "сахар" || a == "молоко")&&(b == "мука" || b == "сахар" || b == "молоко")){Console.WriteLine("YES");}

else {Console.WriteLine("NO");}
}
}
}
using System;

namespace Interview
{
class Program
{
static void Main(string[] args)
{
string a = Console.ReadLine();
string b = Console.ReadLine();
string c = Console.ReadLine();
string d = Console.ReadLine();
string e = Console.ReadLine();
if ((e == "мука" || e == "сахар" || e == "молоко")&&(d == "мука" || d == "сахар" || d == "молоко")&&(c == "мука" || c == "сахар" || c == "молоко")&&(a == "мука" || a == "сахар" || a == "молоко")&&(b == "мука" || b == "сахар" || b == "молоко")){Console.WriteLine("YES");}

else {Console.WriteLine("NO");}
}
}
}
SinFluxx
SinFluxx12mo ago
you missed a ` at the very start to make it format correctly So at the moment you'll be printing out YES only if all 5 inputs match the 3 required ingredients You could put the ingredients in an array or list and then loop through them, and keep count of how many matches you get
Angius
Angius12mo ago
If you're hoping someone's gonna do your homework for you, don't hope for that. Just gonna get it out of the way If not, show us what code you have so far and what the issue is with it
Want results from more Discord servers?
Add your server