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 issue6magicnumbers2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int start = int.Parse(Console.ReadLine());
- int end = int.Parse(Console.ReadLine());
- int magicnumber = int.Parse(Console.ReadLine());
- int combination = 0;
- int count = 0;
- int countotal = count;
- for ( int i=start;i<=end;i++)
- {
- for( int j=start;j<=end;j++)
- {
- combination = i + j;
- count+=1;
- if (combination == magicnumber)
- {
- Console.WriteLine("{0} {1}+{2}={3}", countotal, start, end, magicnumber);
- }
- else
- {
- Console.WriteLine("{0} {1}", countotal, magicnumber);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment