﻿ C# Sharp exercises: Check two given integers and return true if one is negative and one is positive - w3resource

# C# Sharp Exercises: Check two given integers and return true if one is negative and one is positive

## C# Sharp Basic: Exercise-18 with Solution

Write a C# program to check two given integers and return true if one is negative and one is positive.

Sample Solution:

C# Sharp Code:

``````using System;
using System.Collections.Generic;

public class Exercise18 {
static void Main(string[] args)
{
Console.WriteLine("\nInput first integer:");
Console.WriteLine("Input second integer:");
Console.WriteLine("Check if one is negative and one is positive:");
Console.WriteLine((x < 0 && y > 0) || (x > 0 && y < 0));
}
}
``````

Sample Output:

```Input first integer:
-5
Input second integer:
25
Check if one is negative and one is positive:
True
```

Flowchart:

C# Sharp Code Editor:

Improve this sample solution and post your code through Disqus

What is the difficulty level of this exercise?

﻿

New Content: Composer: Dependency manager for PHP, R Programming