Seminar 1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Seminar 1:

• C# është një gjuhë programimi


• .NET është një framework për ndërtimin e aplikacioneve në Windows
• // Koment në një rresht
• /* Një bllok
• me komente
• */

Ushtrimi 1: Ndërton një program në C# që afishon mesazhin: “Mireserdhet ne


C# viti III Informatike”

using System;
using
System.Collections.Generic;
using System.Linq; using
System.Text; using
System.Threading.Tasks;
namespace Ushtrim1
{ class Program
{ static void Main(string[] args)
{
Console.WriteLine("Mireserdhet ne C# viti III Informatike");
Console.ReadLine();
}
}
}

Ne Console:

Ushtrim 2: Ndërto një program në C# që gjenë shumën e dy numrave.

using System;
using
System.Collections.Generic;
using System.Linq; using
System.Text; using
System.Threading.Tasks;
namespace Ushtrim2
{ class Program
{ static void Main(string[] args)
{
Console.WriteLine(4 + 5);
Console.ReadLine();

}
}
}

Ne Console:

Ushtrim 3: Ndërto një program në C# që afishon rezultate për të dhënat e


mëposhtme.

• 3 - 4 * 2
• (54 - 2) % 4
• (2 + 20) * 6 / 12  -23 + 9 / 3 * 2

using System;
using
System.Collections.Generic;
using System.Linq; using
System.Text; using
System.Threading.Tasks;
namespace Ushtrim3
{ class Program
{ static void Main(string[] args)
{
Console.WriteLine(3 - 4 * 2);
Console.WriteLine((54 - 2) % 4);
Console.WriteLine((2 + 20) * 6 / 12);
Console.WriteLine(-23 + 9 / 3 * 2);
Console.ReadLine();
}
}
}

Ne console:
Ushtrim 4: Ndërto një program në C# që i kërkon përdoruesit të japë emrin
dhe moshen e tij, dhe i afishon ato në console.

using System;
using
System.Collections.Generic;
using System.Linq; using
System.Text;
using System.Threading.Tasks;
namespace Ushtrim4
{ class Program
{ static void Main(string[] args)
{
Console.Write("Shkruani emrin
tuaj!"); string emer =
Console.ReadLine();
Console.Write("Jepni moshen tuaj:");
int mosha = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Pershendetje: " + emer + " mosha juaj eshte " + mosha + "
vjece");
Console.ReadLine();

}
}
}

Ne console:

Ushtrim 5: Ndërto një program në C# që afishon figuren si më poshtë.


*
***
*****
*******
*********

using System;
using
System.Collections.Generic;
using System.Linq; using
System.Text; using
System.Threading.Tasks;
namespace Ushtrim5
{ class Program
{ static void Main(string[] args)
{
Console.WriteLine(" * ");
Console.WriteLine(" *** ");
Console.WriteLine(" ***** ");
Console.WriteLine(" ******* ");
Console.WriteLine(" ********* ");
Console.ReadLine();

}
}
}
Ne Console:

Ushtrim 6: Nderto nje program ne C# qe i kerkon user-it te vendose 3 numra


dhe afishon mesataren e tyre.

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

namespace Ushtrim6
{
class Program
{
static void Main(string[] args)
{
double numri1, numri2, numri3;

Console.Write("Vendos numrin e pare :");


numri1 = Convert.ToDouble(Console.ReadLine());
Console.Write("Vendos numrin e dyte :"); numri2
= Convert.ToDouble(Console.ReadLine());
Console.Write("Vendos numrin e trete :");
numri3 = Convert.ToDouble(Console.ReadLine());

double mesatare = (numri1 + numri2 + numri3) / 3;

Console.Write("Mesatarja e numrave eshte: {0}", mesatare);

Console.ReadLine();
}
}
}
Ne Console:

You might also like