Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.58 KB | None | 0 0
  1. namespace uppgift5._2
  2. {
  3.     public partial class Form1 : Form
  4.     {
  5.         private int[] tal = new int[5];
  6.         private int count = 0;
  7.  
  8.         public Form1()
  9.         {
  10.             InitializeComponent();
  11.         }
  12.  
  13.         public int analys(int [] tal)
  14.         {
  15.  
  16.             int uttal;
  17.             uttal = 0;
  18.             uttal++;
  19.  
  20.             if(tal[count] < 0)
  21.             {
  22.                 Antnegl.Text = Convert.ToString(uttal);
  23.                 uttal++;
  24.                 return count;
  25.             }
  26.             else if (tal[count] >= 1)
  27.             {
  28.                 antpos.Text = Convert.ToString(uttal);
  29.                 uttal++;
  30.                 return count;
  31.             }
  32.             else if (tal[count] == 0)
  33.             {
  34.                 antnoll.Text = Convert.ToString(uttal);
  35.                 uttal++;
  36.                 return count;
  37.             }
  38.             else if (tal[count] % 2 == 0)
  39.             {
  40.                 antjämn.Text = Convert.ToString(uttal);
  41.                 uttal++;
  42.                 return count;
  43.             }
  44.             else if (tal[count] % 2 == 1)
  45.             {
  46.                 antudd.Text = Convert.ToString(uttal);
  47.                 uttal++;
  48.                 return count;
  49.             }
  50.             return tal[count];
  51.         }
  52.  
  53.         private void button1_Click(object sender, EventArgs e)
  54.         {
  55.             tal[count] = Convert.ToInt32(Indata.Text);
  56.         }
  57.  
  58.  
  59.         private void button2_Click(object sender, EventArgs e)
  60.         {
  61.             analys(tal).ToString();
  62.         }
  63.        
  64.    
  65.     }
  66.    
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement