+ 3
Hi friends I have a small doubt "Can we use two variables in one equation?" Please explain
This is code Console.WriteLine("enter a number") int a; int b; a = Convert.ToInt32(console.ReadLine()); b=a/2; If (b>o) Console.WriteLine("hi"); But visual studio show b is wrong
11 Answers
+ 2
Mohamed Waseem Ok, this can be solved e.g. as follows.
int a=Convert.ToInt32(Console.ReadLine());
a = a/2;
if(a>0) Console.WriteLine("hi");
else Console.WriteLine("by");
+ 1
First of all the first two statements arenât allowed. Right will be e.g.:
int a;
int b = 8;
The left hand must be a vaisble or property - that means you could code:
a = b;
You can see more examples in my codes.
+ 1
It will be needed to read the errors as follows. That means you have forgoten character ; after the statements in row 14 and 19.
./Playground/file0.cs(14,36): error CS1002: ; expected
./Playground/file0.cs(19,9): error CS1002: ; expected
Here after the first row and after if(b>0);
+ 1
Rithea Sreng aah ok
I typed wrong letter in laptop but here it's right I was so much confused that time
Thanks a lot
+ 1
Yeah we can use
For example
Average =sum/N
0
Hi i was changed the code look again
0
Rithea Sreng Ja Play
Sorry I'm not understand
My idea is
First ask any number from user
Second if user entered number can be divided by 2 say hi
0
Why not.