using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace bt_85
{
class Program
{
static void Main(string[] args)
{
int i, n,x;
double s=0;
do
{
Console.Write("nhap n="); n = int.Parse(Console.ReadLine());
} while (n <= 1 || n >= 30);
Console.Write("nhap x="); x = int.Parse(Console.ReadLine());
for (i = 1; i <= n; i++)
{
s = s + (Math.Pow(x, i) / Math.Pow(3, (i - 1)));
}
Console.Write("tong la:" + s);
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace bt_85
{
class Program
{
static void Main(string[] args)
{
int i, n,x;
double s=0;
do
{
Console.Write("nhap n="); n = int.Parse(Console.ReadLine());
} while (n <= 1 || n >= 30);
Console.Write("nhap x="); x = int.Parse(Console.ReadLine());
for (i = 1; i <= n; i++)
{
s = s + (Math.Pow(x, i) / Math.Pow(3, (i - 1)));
}
Console.Write("tong la:" + s);
Console.ReadKey();
}
}
}