Priprema Za Kolokvijum

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

PRIPREMA ZA KOLOKVIJUM

1. Za dati algoritam napisati izlazne vrednosti:

2. Za dati program u programskom jeziku C# napisati ta e biti ispisano na


ekranu:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int x, y;
x = 25;
y =x+ 100;
z = x + y;
x = z - z;
y = x;
if (x > y)
Console.WriteLine("x= " + x);
else if ( x = = y)
Console.WriteLine("y= " + y);
else
Console.WriteLine("x = y " + x);
Console.ReadLine();
}
}
}

3. Pronai 5 greaka i kroz komentar ih objasni i napii pravilan kod unutar


komentara.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(unesi dva broja);
int x = ToInt32(Console.ReadLine());
int y: Convert.ToInt32(Console.ReadLine());
if (x = y)
{
Console.WriteLine("Isti");
}
else
{
if (x > y);
{
Console.WriteLine("veci broj je "+x);
}
else
{
Console.WriteLine("y veci");
}
}
Console.ReadLine();
}
}}

4. Proitaj paljivo kod zadataka, pa reima opii koji uslov je neophodno


ispuniti da bi se ispisala poruka .
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Molimo unesite boju cizama ");
string cizme = Console.ReadLine();
Console.WriteLine("Molimo unesite boju za kosulju");
string kosulja = Console.ReadLine();
Console.WriteLine("Molimo unesite boju pantalona");
string pantalone = Console.ReadLine();
if ( (cizme=="crvena" || kosulja=="plava") && ( kosulja=="bela" ||
pantalone=="bela") && pantalone=="plava")
Console.WriteLine("Cestitamo, obukli ste trazenu kombinaciju");
Console.ReadLine();
}
}
}

5. Sastaviti kod koristei


a. else if
b. switch

You might also like