Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace aplicatiecuvectori
- {
- public partial class Form1 : Form
- {
- int n, sp = 0, ci=0, i=1, contor = 0;
- int[] V = new int[100];
- public Form1()
- {
- InitializeComponent();
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void label2_Click(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- n = int.Parse(textBox1.Text);
- textBox1.Text = " ";
- }
- private void button2_Click(object sender, EventArgs e)
- {
- if (n >= i)
- {
- V[i] = int.Parse(textBox2.Text);
- i++;
- richTextBox1.Text = richTextBox1.Text + " " + textBox2.Text;
- textBox2.Text = " ";
- }
- else textBox2.Enabled = false;
- }
- private void button3_Click(object sender, EventArgs e)
- {
- for (i = 1; i <= n; i++)
- {
- if (V[i] % 2 != 0)
- ci++;
- }
- textBox3.Text = ci.ToString();
- }
- private void button4_Click(object sender, EventArgs e)
- {
- for (i = 1; i <= n; i++)
- if (V[i] % 2 == 0)
- sp = sp + V[i];
- textBox4.Text = sp.ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement