You are on page 1of 3

Lab program

Printing a line of text :

2
: ‫برنامج لجمع رقمين‬

Write a c# program that read two number and print the sum of given
tow numbers

int A,B,SUM;
Console.Write("inter the first number:");
A=int.Parse(Console.ReadLine());
Console.Write("inter the second number:");
B=int.Parse(Console.ReadLine());
SUM=A+B;
Console.Write("THE SUM IS :{0}",SUM);

‫برنامج يقرأ رقمين ويقارن بينهم‬


Write a c# program that read two number and Compare between
them
int N1, N2;
Console.Write("inter the first number:");

N1 = Convert.ToInt32(Console.ReadLine());

Console.Write("inter the second number:");

N2 = Convert.ToInt32(Console.ReadLine());

if (N1 == N2)

Console.Write("{0}={1} equal", N1, N2);

else if (N1 <= N2)

Console.Write("{0}<{1}",N1,N2);

else if (N1 >= N2)

Console.Write("{0}>{1}", N1, N2);


int mark,sum=0;
double avg;
int c=1;
while(c<=10){

mark = Convert.ToInt32(Console.ReadLine());
c=c+1;
sum=sum+mark;
}
avg=sum/10;

Console.WriteLine(avg);

You might also like