Console.WriteLine("NAMBER 1");
double A = double.Parse(Console.ReadLine());
double b = double.Parse(Console.ReadLine());
//خط پایین عملیات توان را انجام می دهد
double p = Math.Pow(A, (int)b);
Console.WriteLine(p);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
bool cont = true;
while (cont)
{
Console.WriteLine("namber 1");
double namber1 = double.Parse(Console.ReadLine());
Console.WriteLine("amalkard");
string math = Console.ReadLine();
Console.WriteLine("namber 2");
double namber2 = double.Parse(Console.ReadLine());
double res;
//برای تبدیل دابل به استرینگ از خط زیرین استفاده می کنیم
//double namber1 = double.Parse(namber2);
switch (math)
{
case "+":
res = namber1 + namber2;
Console.WriteLine(res);
break;
case "-":
res = namber1 - namber2;
Console.WriteLine(res);
break;
case "*":
res = namber1 * namber2;
Console.WriteLine(res);
break;
case "/":
res = namber1 / namber2;
Console.WriteLine(res);
break;
}
// برای رفتن به خط بعد در رایت لاین با ید از بک اسلش ان استفاده کنیم
Console.WriteLine("Do you want to continue?");
string answer = Console.ReadLine();
if (answer == "no" || answer == "n" || answer == "No" || answer == "N" || answer == "NO")
cont = false;
}
}
}
}
double namber1 = double.Parse(namber2)
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)
{
//برای شروع حلقه یک استرینگ از نوع بولین تعریف میکنیم به عنوان درست
bool cont = true;
//وایل که حلقه هست را می گزاریم و حلقه نا تمام درست می کنیم
while (cont)
{
//عددی از طرف مقابل می گیریم به معنای اینکه تا چه عددی حلقه انجام شود
int a = int.Parse(Console.ReadLine());
// فور که یک حلقه است تعریف می کنیم برای ستون ها
for (int i = 1; i <= a; i++)
{
//این فور برای سطر ها هست
for (int z = 1; z < i; z++)
{
Console.Write(i);
}
Console.WriteLine(i);
}
//یکی از عدد اول کم میکنیم تا از یه سطر دو بار چاپ نشود
//و برعکس بالا انجام می دهیم
int b = a - 1;
for (int i = b; i >= 1; i--)
{
for (int z = 1; z < i; z++)
{
Console.Write(i);
}
Console.WriteLine(i);
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
double radius;
double thickness = 0.4;
ConsoleColor BorderColor = ConsoleColor.Yellow;
Console.ForegroundColor = BorderColor;
do
{
Console.Write("Enter radius:::: ");
if (!double.TryParse(Console.ReadLine(), out radius) || radius <= 0) //این ایف برای اینه که عدد وارد شده باشد و بزرگ تر صفر هم باشد
{//double.TryParse برای این هست که عدد بگیرد
Console.WriteLine("radius have to be positive number");
}
}
while (radius <= 0);
{
Console.WriteLine();
double rIn = radius - 0.4, rOut = radius + 0.4;
for (double y = radius; y >= -radius; --y)
{
for (double x = -radius; x < rOut; x += 0.5)
{
double value = x * x + y * y;
if (value >= rIn * rIn && value <= rOut * rOut)
{
Console.Write("0");
}
else
{
Console.Write(" ");
}
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
}