Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
Ok, so im making a math game where there is two random numbers that u need to subtract
So im using a random int generator, and it defines 2 ints, Mathquestion1 and mathquestion2 it asks about what mathquestion1 - mathquestion2 is (mathquestion1 and mathquestion2 has a random number between 1 and 50 in it)
So i need to subtract those values to define the answer
Any way i can do this
NOTE: Im a C# Beginner

What I have tried:

C#
mathquestion1 - mathquestion2<pre lang="c#">
Posted
Updated 11-May-17 21:55pm
v2
Comments
[no name] 11-May-17 15:29pm    
"Any way i can do this", yes try subtracting the integers using the - operator.
Member 13194839 11-May-17 15:30pm    
int1-int2?
Member 13194839 11-May-17 15:32pm    
Didnt work
[no name] 11-May-17 15:34pm    
Yes it does. It works every time. YOU are doing something wrong. But since you decided not to explain the actual problem or show your code..... what is it that you expect us to do for you?
RickZeeland 11-May-17 15:37pm    
Show your code please, or a relevant piece of it.

If you're asking such a basic question you REALLY need to pickup a beginners book on C# and work through it. You need to assign the value to some other variable in order for anything to make sense and be usable.
C#
int result = int1 - int2;
 
Share this answer
 
Comments
Member 13194839 11-May-17 15:42pm    
If i find one, i will
RickZeeland 11-May-17 16:30pm    
DotNetPerls is a good place to start: https://www.dotnetperls.com/int
C#
int answer = mathquestion1 - mathquestion2;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900