Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication4
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] nizBrojeva = new int[30];
- Console.WriteLine("Unesi broj brojeva u nizu:");
- int brojac = Convert.ToInt16(Console.ReadLine());
- Console.WriteLine("Unesi elemente niza:");
- int pozicija100=-1;
- for(int i=0;i<brojac;i++)
- {
- nizBrojeva[i] = Convert.ToInt32(Console.ReadLine());
- }
- for (int i = 0; i < brojac; i++)
- {
- Console.WriteLine("Pozicija[{0}]={1}", i, nizBrojeva[i]);
- if(nizBrojeva[i]==100)
- {
- pozicija100 = i;
- }
- }
- if(pozicija100==-1)
- {
- Console.WriteLine("U nizu se ne nalazi broj 100");
- }
- else
- {
- Console.WriteLine("Pozicija na kojoj se nalazi 100 je {0}", pozicija100);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement