C# 求两个三位数abc与cba的和为1333
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace norm_program
{
class Program
{
static void Main(string[] args)
{
int sum=0,a=0,b=0,c=0;
for (a=0; a < 10; a++)//使得a在0~9范围内取值;
{
for (b = 0; b < 10; b++)
{
for (c = 0; c < 10 ; c++)
{
sum = ((a * 100 + b * 10 + c) + (c * 100 + b * 10 + a));
if (sum == 1333)
Console.WriteLine("满足两个三位数abc与cba之和为1333的数字分别为:a={0},b={1},c={2}。",a,b,c);
}
}
}
Console.ReadLine();
}
}
}