Advertisement
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 ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int counterForLuckyTickets = 0;
- int counterForNormalTickets = 0;
- int totalTickets = counterForLuckyTickets + counterForNormalTickets;
- for(int a = 1; a <= 9; a++)
- {
- for(int b = 0; b <= 9; b++)
- {
- for(int c = 0; c <= 9; c++)
- {
- for(int d = 0; d <= 9; d++)
- {
- for(int e = 0; e <= 9; e++)
- {
- for(int f = 0; f <= 9; f++)
- {
- if ((a + b + c) == (d + e + f))
- {
- counterForLuckyTickets++;
- string resultLuckyTickets = a + " " + b + " " + c + " " + d + " " + e + " " + f;
- Console.WriteLine(resultLuckyTickets);
- }
- else if ((a + b + c) != (d + e + f))
- {
- counterForNormalTickets++;
- }
- }
- }
- }
- }
- }
- }
- Console.WriteLine("Total lucky ticket numbers are:{0}",counterForLuckyTickets);
- Console.WriteLine("Total not lucky ticket numbers are:{0}",counterForNormalTickets);
- Console.WriteLine("Total tickets existing are:{0}", totalTickets);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement