0% found this document useful (0 votes)
25 views7 pages

Homework 1

Uploaded by

alinaselekta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views7 pages

Homework 1

Uploaded by

alinaselekta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

1 ‫תרגיל‬

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp2
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please enter your grade: ");
int grade = int.Parse(Console.ReadLine());
if (grade > 55)
Console.WriteLine(grade + " Good job");
else
Console.WriteLine(grade + " Failed");

}
}
}

2 ‫תרגיל‬
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp2
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the number that is the
numerator: ");
double numerator = double.Parse(Console.ReadLine());
Console.WriteLine("Enter the number that is the
denominator");
double denominator = double.Parse(Console.ReadLine());
if (denominator == 0)
{
Console.WriteLine("It is forbidden to devide by 0");
}
else
{
double resultofdivision = numerator / denominator;
Console.WriteLine("The division of these numbers is
equal to: " + numerator + "/" + denominator + "=" +
resultofdivision);
}
}
}
}

3 ‫תרגיל‬

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace driverlicense
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Write your driver number");
string drivernumber = Console.ReadLine();
Console.WriteLine("Write your speed in hour");
int speedinhour = int.Parse(Console.ReadLine());
Console.WriteLine("Write allowed speed");
int allowedspeed = int.Parse(Console.ReadLine());
int penalty = speedinhour - allowedspeed;
if (penalty > 0)
{
int payment = penalty * 30;
Console.WriteLine("You have exceeded a speed limit");
Console.WriteLine("Your driver number " +
drivernumber);
Console.WriteLine("You have to pay " + payment + "
shekels");
}
else
{
Console.WriteLine("Well done, you didn't exceeded a
speed!");
}
}
}
}

4 ‫תרגיל‬
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace driverlicense
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Write number of threes");
int numberofthrees = int.Parse(Console.ReadLine());
int firstdigit = numberofthrees / 100;
int seconddigit = numberofthrees % 10;
if (firstdigit == seconddigit)
{
Console.WriteLine("You have written number "+
numberofthrees);
Console.WriteLine("This number is a pallyndrome");
}
else
{
Console.WriteLine("You have written number " +
numberofthrees);
Console.WriteLine("This number isn’t a pallyndrome");
}
}
}
}

5 ‫תרגיל‬
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace driverlicense
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Write first number");
int number1 = int.Parse(Console.ReadLine());
Console.WriteLine("Write second number");
int number2 = int.Parse(Console.ReadLine());
if (number1 == number2)
{
Console.WriteLine("Numbers are equal");
}
else
{
Console.WriteLine("Numbers aren't equal");
}
}
}
}

6 ‫תרגיל‬

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace driverlicense
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter a positive integer that is
greater than the second number:");
int number1 = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the second positive number:");
int number2 = int.Parse(Console.ReadLine()); if
(number1 % number2 == 0)
{
int quotient = number1 / number2;
Console.WriteLine(number1 + " is divided by "
+ number2 + " without remainder, the quotient is " +
quotient);
}
else
{
int quotient = number1 / number2; int
remainder = number1 % number2;
Console.WriteLine(number1 + " is not divisible
by " + number2 + " ,the quotient is " + quotient + " ,the
remainder is equal to " + remainder);
}
}
}
}

7 ‫תרגיל‬
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace driverlicense
{
internal class Program
{
static void Main(string[] args)
{
double cost1, cost2, cost3;

Console.WriteLine("Write cost of the first item: ");


cost1 = double.Parse(Console.ReadLine());
Console.WriteLine("Write cost of the second item:
");
cost2 = double.Parse(Console.ReadLine());
Console.WriteLine("Write cost of the third item: ");
cost3 = double.Parse(Console.ReadLine());
double totalcost = cost1 + cost2 + cost3;
if (totalcost > 100)
{
Console.WriteLine("your total cost:" +
totalcost);
double sale = totalcost / 10;
double salecost = totalcost - sale;
Console.WriteLine("your total cost with the
sale: " + salecost);
}

}
}
}

You might also like