C# Sharp Exercises: Print the result of print the result of the specified operations
C# Sharp Basic: Exercise-4 with Solution
Write a C# Sharp program to print the result of the specified operations.
C# Sharp: Working with Arithmetic Expression
Sample Solution:
C# Sharp Code:
public class Exercise4
{
public static void Main()
{
System.Console.WriteLine(-1+4*6);
//-1 + 24 = 23
System.Console.WriteLine((35+5)%7);
//40 % 7 = 5 (remainder of 40/7)
System.Console.WriteLine(14+-4*6/11);
//14 - (24/11)= 14 - 2 = 12
System.Console.WriteLine(2+15/6*1-7%2);
//2 + (15/6) - remainder of (7/2) = 2 + 2 - 1 = 4 - 1 = 3
}
}
Sample Output:
23 5 12 3
Flowchart:
C# Sharp Code Editor:
Improve this sample solution and post your code through Disqus
Previous: Write a C# Sharp program to print the result of dividing two numbers.
Next: Write a C# Sharp program to swap two numbers.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework