Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace uppgift5._2
- {
- public partial class Form1 : Form
- {
- private int[] tal = new int[5];
- private int count = 0;
- public Form1()
- {
- InitializeComponent();
- }
- public int analys(int [] tal)
- {
- int uttal;
- uttal = 0;
- uttal++;
- if(tal[count] < 0)
- {
- Antnegl.Text = Convert.ToString(uttal);
- uttal++;
- return count;
- }
- else if (tal[count] >= 1)
- {
- antpos.Text = Convert.ToString(uttal);
- uttal++;
- return count;
- }
- else if (tal[count] == 0)
- {
- antnoll.Text = Convert.ToString(uttal);
- uttal++;
- return count;
- }
- else if (tal[count] % 2 == 0)
- {
- antjämn.Text = Convert.ToString(uttal);
- uttal++;
- return count;
- }
- else if (tal[count] % 2 == 1)
- {
- antudd.Text = Convert.ToString(uttal);
- uttal++;
- return count;
- }
- return tal[count];
- }
- private void button1_Click(object sender, EventArgs e)
- {
- tal[count] = Convert.ToInt32(Indata.Text);
- }
- private void button2_Click(object sender, EventArgs e)
- {
- analys(tal).ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement