You are on page 1of 7

1.

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

namespace ConsoleApplication18
{
class Program
{
static void Main(string[] args)
{
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
int k = int.Parse(Console.ReadLine());
double m;
for (int i = a; i <= b; i = i + k)
{
m = 1609.344 * i/1000;
Console.WriteLine(i + " mi = " + m.ToString("0.000000") + " km");
}
Console.ReadKey();
}
}
}
2. using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication33
{
class Program
{
static void Main(string[] args)
{
double v0 = double.Parse(Console.ReadLine());
double a = double.Parse(Console.ReadLine());
double T = double.Parse(Console.ReadLine());
double t = double.Parse(Console.ReadLine());
double s = 0;
for (double i = 0; i <= T; i = i + t)
{
s = v0 * i + (a * Math.Pow(i, 2) / 2);
Console.WriteLine(s.ToString("0.00000"));
}
Console.ReadKey();
}
}
}
tabeliranje funkcija
3. using System;

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

namespace ConsoleApplication18
{
class Program
{
static void Main(string[] args)
{
int n = int.Parse(Console.ReadLine());
int k = int.Parse(Console.ReadLine());
double b;
int br=0;
int c;
for (int i = 0; i < n; i++)
{
b = int.Parse(Console.ReadLine());
if (b <= k)
br++;
else
{
b = b / k;
b = Math.Ceiling(b);
c = Convert.ToInt32(b);
br = br + c;
}

}
Console.WriteLine(br);
Console.ReadKey();
}
}
}
4.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication18
{
class Program
{
static void Main(string[] args)
{
int x = int.Parse(Console.ReadLine());
int n = int.Parse(Console.ReadLine());
int r = 0;
int g;
for (int i = 0; i < n; i++)
{
g = int.Parse(Console.ReadLine());
if (g == x)
r++;
}
Console.WriteLine(r);
Console.ReadKey();
}
}
}
5.using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication18
{
class Program
{
static void Main(string[] args)
{
int n = int.Parse(Console.ReadLine());
int i = 0;
int[] broj = new int[n];
for (i = 0; i < n; i++)
{
broj[i] = int.Parse(Console.ReadLine());
}
for (i = 0; i < n; i++)
{
if (broj[i] % 3 == 0)
{
Console.WriteLine(broj[i]);
}
}
Console.ReadKey();
}
}
}
6.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication18
{
class Program
{
static void Main(string[] args)
{
int n = int.Parse(Console.ReadLine());
Console.ReadKey();
int t;
int l = 0, s = 0, h = 0;
for (int i = 0; i < n; i++)
{
t = int.Parse(Console.ReadLine());
if (t <= 50)
l++;
else if (t <= 75)
s++;
else
h++;
}
Console.WriteLine(l);
Console.WriteLine(s);
Console.WriteLine(h);
}
}
}
7 using System;
namespace prvi_i_poslednji_pristup
{
class Program
{
static void Main(string[] args)
{
int r = int.Parse(Console.ReadLine());
int n = int.Parse(Console.ReadLine());
int najmbr = 0, najvbr = 0;
string najmime = "nesto", najvime = "nesto";
bool jeste = true;
for(int i = 0; i < n; i++)
{
string[] s = Console.ReadLine().Split();
int br = int.Parse(s[0]);
string ime = s[1];
if(br == r)
{
if(jeste)
{
najmbr = br;
najmime = ime;
jeste = false;
}
else
{
najvbr = br;
najvime = ime;
}
}
}
Console.WriteLine(najmime);
Console.WriteLine(najvime);
}
}
}
8.
int n = int.Parse(Console.ReadLine());
double a;
bool s=false;
for (int i = 0; i < n; i++)
{
a = double.Parse(Console.ReadLine());
if (a < 0)
{
s = true;
break;
}
else
s = false;

}
if (s)
Console.WriteLine("postoji");
else
Console.WriteLine("ne postoji");
Console.ReadKey();
9.
double k = double.Parse(Console.ReadLine());
double n = double.Parse(Console.ReadLine());
bool a=false;
for (double i = 0; i < n; i++)
{
if (k % i == 0)
a = true;
else
a = false;
}
if (a)
Console.WriteLine("da");
else
Console.WriteLine("ne");
Console.ReadKey();
}
}
}

You might also like