Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication10
- {
- class Program
- {
- static void Main(string[] args)
- {
- int families, boys, totalboys = 0, girls, totalgirls = 0, equaltot = 0, kids = 0;
- int tempfamily, avg;
- Console.Write("Enter the ammount of families you are about to check: ");
- families = int.Parse(Console.ReadLine());
- tempfamily = families;
- for (; families > 0; families--)
- {
- Console.Write("Ammount of boys in the family: ");
- boys = int.Parse(Console.ReadLine());
- totalboys = totalboys + boys;
- Console.Write("Ammount of girls in the family: ");
- girls = int.Parse(Console.ReadLine());
- totalgirls = totalgirls + girls;
- kids = boys + girls;
- Console.WriteLine("There are " + kids + " kids in the family! Yay!");
- if (boys == girls)
- {
- equaltot++;
- }
- }
- avg = totalgirls / tempfamily; // Can't be avg of double for people! (for ex: avg of 3.444 girls)
- Console.WriteLine("There is an avg of " + avg + " girls in each family");
- Console.WriteLine("There are " + equaltot + " families with ammount of boys equal to girls");
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment