Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication4
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int[] nizBrojeva = new int[30];
  14. Console.WriteLine("Unesi broj brojeva u nizu:");
  15. int brojac = Convert.ToInt16(Console.ReadLine());
  16. Console.WriteLine("Unesi elemente niza:");
  17. int pozicija100=-1;
  18. for(int i=0;i<brojac;i++)
  19. {
  20. nizBrojeva[i] = Convert.ToInt32(Console.ReadLine());
  21. }
  22. for (int i = 0; i < brojac; i++)
  23. {
  24. Console.WriteLine("Pozicija[{0}]={1}", i, nizBrojeva[i]);
  25. if(nizBrojeva[i]==100)
  26. {
  27. pozicija100 = i;
  28. }
  29. }
  30. if(pozicija100==-1)
  31. {
  32. Console.WriteLine("U nizu se ne nalazi broj 100");
  33. }
  34. else
  35. {
  36. Console.WriteLine("Pozicija na kojoj se nalazi 100 je {0}", pozicija100);
  37. }
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement