Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp4
- {
- class Program
- {
- static void Main(string[] args)
- {
- StreamReader sr = new StreamReader("adatok.txt");
- Console.WriteLine("1. Feladat");
- List<int> darabszam = new List<int>();
- while (!sr.EndOfStream)
- {
- darabszam.Add(Convert.ToInt32(sr.ReadLine()));
- }
- Console.WriteLine("Ennyi darab szám van: " + darabszam.Count);
- Console.WriteLine("2. Feladat");
- double atlag;
- double osszeg = 0;
- for (int i = 0; i < darabszam.Count; i++)
- {
- osszeg = osszeg + darabszam[i];
- }
- atlag = osszeg / darabszam.Count;
- Console.WriteLine("Számok átlaga: " + atlag);
- Console.WriteLine("3 .Feladat");
- if (darabszam.Contains(0))
- {
- Console.WriteLine("Van benne nulla");
- }
- else
- {
- Console.WriteLine("Nincs benne 0");
- }
- Console.WriteLine("4. Feladat");
- List<int> ezer = new List<int>();
- for (int i = 0; i < darabszam.Count; i++)
- {
- if (darabszam[i]==1000)
- {
- ezer.Add(darabszam[i]);
- }
- }
- Console.WriteLine("Ennyi 1000 van benne: " + ezer.Count);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement