Advertisement
Adijata

Prva vježba 2013 RPR treći zadatak

Oct 9th, 2014
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 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 ConsoleApplication7
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.            
  14.            
  15.  
  16.             int i = 0;
  17.             bool neg=false;
  18.             bool prolaz1=false;
  19.             bool prolaz2=false;
  20.             bool neparni=false;
  21.             while (i < 6)
  22.             {
  23.                 Console.WriteLine("Unesite broj: ");
  24.                 int broj=int.Parse(Console.ReadLine());
  25.                 if(prolaz1==false)
  26.                 {
  27.                     if (broj < 0) neg = true; prolaz1 = true;
  28.                 }
  29.                 if (prolaz2 == false)
  30.                 {
  31.                     if (broj % 2!=0) neparni = true; prolaz1 = true;
  32.                 }
  33.                 i++;
  34.             }
  35.  
  36.             Console.WriteLine("U nizu ima neparnih brojeva: {0}. U nizu ima negativnih brojeva: {1}", neparni, neg);
  37.             Console.ReadLine();
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement