Yardım Methods C#

Bu konuyu okuyanlar

makitaysın

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
2
Reaksiyon puanı
0
Puanları
1
Yaş
22
Yapılan uygulama içerisinde bölümlere, kendi içerisinde küçük parçalara ayrılarak oluşturulan ve sonradan çağırılma amacı ile kullanılabilen kod satırlarıdır.
 

xdd34

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
8
Reaksiyon puanı
0
Puanları
1
Yaş
23
using System;

namespace MyApplication
{
class Program
{
static void Main(string[] args)
{
int day = 4;
switch (day)
{
case 1:
Console.WriteLine("Monday");
break;
case 2:
Console.WriteLine("Tuesday");
break;
case 3:
Console.WriteLine("Wednesday");
break;
case 4:
Console.WriteLine("Thursday");
break;
case 5:
Console.WriteLine("Friday");
break;
case 6:
Console.WriteLine("Saturday");
break;
case 7:
Console.WriteLine("Sunday");
break;
}
}
}
}
Mesaj otomatik birleştirildi:

c# iyi dildir
 
Son düzenleme:

eternalxs

Öğrenci
Katılım
7 Eylül 2020
Mesajlar
69
Reaksiyon puanı
81
Puanları
18
Bu dille alakalı bazı sorularım var ama
Mesaj otomatik birleştirildi:

ilk sorum bu;

namespace ExamStudyy2
{
//method kullanarak hesap makinesi yapma
internal class Program
{
public static int result = 0;
public static void hesapMakinesi()
{
Console.WriteLine("Enter the number one: ");
int sayi1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the number two: ");
int sayi2 = Convert.ToInt32(Console.ReadLine());

Console.WriteLine("Enter the op: +,-,*,/");
string op = Console.ReadLine();

switch (op)
{
case "+":
result = sayi1 + sayi2;
break;
case "-":
result = sayi1 - sayi2;
break;
case "*":
result = sayi1 * sayi2;
break;
case "/":
result = sayi1 / sayi2;
break;
default:
Console.Write("Enter a valid op");
break;

}

}

static void Main(string[] args)
{

hesapMakinesi();
Console.WriteLine("The result is: " + result);
Console.Read();



}
}
}
Mesaj otomatik birleştirildi:

ikinci sorum şu;
namespace examStudyHighScore
{
internal class Program
{
static int highScore = 150;
static string highScorePlayer = "Ethan";

static void highScoreApp()
{
Console.WriteLine("Enter your name and score: ");
string name = Console.ReadLine();
int score = Int32.Parse(Console.ReadLine());

if (score > highScore)
{
score = highScore;
highScorePlayer = name;
Console.WriteLine("Now you have the highest score " + name + "!");

}
else
{
Console.WriteLine(highScore + "is the highest score. Owner is " + highScorePlayer);

}



}
static void Main(string[] args)
{
highScoreApp();
Console.Read();
}
}
}
Mesaj otomatik birleştirildi:

üçüncü sorum şu;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace examStudyTryCatch
{
internal class Program
{
//Hata yakalamak için try catch kullandık. Catch kısmında hatanın sonucunda
// ne olacağına karar verdik.
static void Main(string[] args)
{
//try
//{
// Console.WriteLine("Enter a number: ");
// var num = Int32.Parse(Console.ReadLine());

// if (num <= 15)
// {
// Console.WriteLine("It's too cold");

// }
// else if (num <= 16 && num <= 28)
// {
// Console.WriteLine("It's okay");
// }
// else
// {
// Console.WriteLine("It's too hot.");
// }

//}
//catch (Exception ex)
//{
// Console.Write("Error info:" + ex.Message);
//}
Console.Write("Please enter a number to divide 100: ");

try
{
int num = int.Parse(Console.ReadLine());

int result = 100 / num;

Console.WriteLine("100 / {0} = {1}", num, result);
}
catch (DivideByZeroException ex)
{
Console.Write("Cannot divide by zero. Please try again.");
}
catch (InvalidOperationException ex)
{
Console.Write("Invalid operation. Please try again.");
}
catch (FormatException ex)
{
Console.Write("Not a valid format. Please try again.");
}
catch (Exception ex)
{
Console.Write("Error occurred! Please try again.");
}


Console.ReadKey();

}
}
}
Mesaj otomatik birleştirildi:

dördüncü sorum şu;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace examStudyy
{
internal class Program
{
//static void MyMethod()
//{
// Console.WriteLine("My method example");
//}

static void methodString(string ad, string soyAd)
{
Console.WriteLine(ad + soyAd);
}

static void countries(string country = "Turkey")
{
Console.WriteLine(country);
}

static int numberX(int x)
{
return 5 + x;
}

static int numberXandY(int x, int y)
{
return x + y;
}

static int anotherXandY(int x, int y)
{
return x + y;
}

static void childNames(string child1, string child2, string child3)
{
Console.WriteLine("The youngest child is: " + child3);
}

static void Main(string[] args)
{

methodString("Selahattin ", "Acar");
methodString("Onat ", "Aydın");
methodString("Erdem ", "Akdoğan");

countries("Iceland");
countries("Germany");
countries();
countries("USA");

Console.WriteLine(numberX(2));
Console.WriteLine(numberX(3));
Console.WriteLine(numberX(4));

Console.WriteLine(numberXandY(5, 8));
Console.WriteLine(numberXandY(10, 21));
Console.WriteLine(numberXandY(15, 300));

int z = anotherXandY(3, 5);
Console.WriteLine(z);
int b = anotherXandY(6, 7);
Console.WriteLine(b);

childNames(child3: "Ethan", child2: "Karen", child1: "Amber");







//MyMethod();
Console.ReadLine();





}
}
}
Mesaj otomatik birleştirildi:

BURADA HATALARIMI NASIL BULACAĞIM?
Mesaj otomatik birleştirildi:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace examDenemee
{
class Program
{
static void Main(string[] args)
{
string input = "0";
int count = 0;
int total = 0;
int currentNumber = 0;

while (input != "-1")
{
Console.WriteLine("Last number was {0}", currentNumber);
Console.WriteLine("Please enter the next score");
Console.WriteLine("Current amount of entries {0}", count);
Console.WriteLine("Please enter -1 once you are ready to calculate the average");

input = Console.ReadLine();
if (input == ("-1"))
{
Console.WriteLine("--------------------------------------------");
double average = (double)total / (double)count;
Console.WriteLine("The average score of your students is {0}", average);
}
if (int.TryParse(input, out currentNumber) && currentNumber > 0 && currentNumber < 21)
{
total += currentNumber;
}
else
{
if (!(input.Equals("-1")))
{
Console.WriteLine("Please enter a value between 1 and 20!");
}
continue;
}

count++;

}

Console.ReadLine();
}
}
}
Mesaj otomatik birleştirildi:

BU KONULARDA ZORLANIYORUM
Mesaj otomatik birleştirildi:

 
Son düzenleme:

xdd34

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
8
Reaksiyon puanı
0
Puanları
1
Yaş
23
teşekkürler.
 

xdd34

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
8
Reaksiyon puanı
0
Puanları
1
Yaş
23
Cihaz.
Mesaj otomatik birleştirildi:

using System;

namespace MyApp // Note: actual namespace depends on the project name.
{
internal class Program
{
static void Main(string[] args)
{
int yas, kilo=0, boy=0;
Boolean devam = true;
int devam2 = 1;
Console.WriteLine("Lütfen yasinizi giriniz");
yas =Convert.ToInt32(Console.ReadLine());
Console.WriteLine(yas);
try
{
do
{
if (yas >= 20)
{
Console.WriteLine("Lütfen kilo giriniz");
string giris1 = Console.ReadLine();

Console.WriteLine("Lütfen boy giriniz");
string giris2 =Console.ReadLine();

Console.WriteLine(VKIHesaplama(kilo, boy));
if(int.TryParse(giris2, out boy)&&int.TryParse(giris1, out kilo))
{


}
else
{
Console.WriteLine("Dogru formatta giriniz");

}
Console.WriteLine("Devam etmek istiyor musunuz? 1-Evet 2-Hayır");
devam2 =Convert.ToInt32(Console.ReadLine());
switch (devam2)
{
case 1: devam = true; break;
case 2: devam = false; break;
}
}
else
Console.WriteLine("Yas 20 ve üstü olmalıdır tekrar giriniz.");

} while (devam);

}
catch (FormatException hata)
{
Console.WriteLine("Yanlış formatta değer girildi tekrar giriniz.");

}
catch (Exception)
{

throw;
}

}
public static string VKIHesaplama(int kilo,int boy)
{
float vki = kilo/boy*boy;
if (vki>18.5 && vki < 30.0)
return vki >18.5 && vki <24.9 ? "Healthy weight " : "Over weight";
else if (vki>30)
return " obesity";
else return "underweight";
}
}
}
 
Son düzenleme:

NecimDurmaz

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
9
Reaksiyon puanı
0
Puanları
1
Yaş
21
using System;

namespace MyApp // Note: actual namespace depends on the project name.
{
internal class Program
{
static void Main(string[] args)
{
int yas, kilo = 0;
float boy=0;
Boolean devam = true;
int devam2 = 1;
Console.WriteLine("Lütfen yasinizi giriniz");
yas =Convert.ToInt32(Console.ReadLine());

try
{
do
{
if (yas >= 20)
{
Console.WriteLine("Lütfen kilo giriniz");
kilo =Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Lütfen boy giriniz");
boy =Convert.ToInt32(Console.ReadLine());

Console.WriteLine(VKIHesaplama(kilo, boy));

Console.WriteLine("Devam etmek istiyor musunuz? 1-Evet 2-Hayır");
devam2 =Convert.ToInt32(Console.ReadLine());
switch (devam2)
{
case 1:devam = true; break;
case 2:devam = false; break;
}
}
else
Console.WriteLine("Yas 20 ve üstü olmalıdır tekrar giriniz.");

} while (devam);

}
catch (FormatException hata)
{
Console.WriteLine("Yanlış formatta değer girildi tekrar giriniz.");

}
catch (Exception)
{

throw;
}

}
public static string VKIHesaplama(int kilo,float boy)
{
float boyvki=boy/100 ;
Console.WriteLine(boyvki);
float vki = kilo/boyvki*boyvki;
if (vki>18.5 && vki < 30.0)
return vki >18.5 && vki <24.9 ? "Healthy weight " : "Over weight";
else if (vki>30)
return " obesity";
else return "underweight";
}
}
}
Mesaj otomatik birleştirildi:

Cihaz.
Mesaj otomatik birleştirildi:

using System;

namespace MyApp // Note: actual namespace depends on the project name.
{
internal class Program
{
static void Main(string[] args)
{
int yas, kilo=0, boy=0;
Boolean devam = true;
int devam2 = 1;
Console.WriteLine("Lütfen yasinizi giriniz");
yas =Convert.ToInt32(Console.ReadLine());
Console.WriteLine(yas);
try
{
do
{
if (yas >= 20)
{
Console.WriteLine("Lütfen kilo giriniz");
string giris1 = Console.ReadLine();

Console.WriteLine("Lütfen boy giriniz");
string giris2 =Console.ReadLine();

Console.WriteLine(VKIHesaplama(kilo, boy));
if(int.TryParse(giris2, out boy)&&int.TryParse(giris1, out kilo))
{


}
else
{
Console.WriteLine("Dogru formatta giriniz");

}
Console.WriteLine("Devam etmek istiyor musunuz? 1-Evet 2-Hayır");
devam2 =Convert.ToInt32(Console.ReadLine());
switch (devam2)
{
case 1: devam = true; break;
case 2: devam = false; break;
}
}
else
Console.WriteLine("Yas 20 ve üstü olmalıdır tekrar giriniz.");

} while (devam);

}
catch (FormatException hata)
{
Console.WriteLine("Yanlış formatta değer girildi tekrar giriniz.");

}
catch (Exception)
{

throw;
}

}
public static string VKIHesaplama(int kilo,int boy)
{
float vki = kilo/boy*boy;
if (vki>18.5 && vki < 30.0)
return vki >18.5 && vki <24.9 ? "Healthy weight " : "Over weight";
else if (vki>30)
return " obesity";
else return "underweight";
}
}
}
boy'da cm yerine metre kullanılıyormuş bir bakmanı öneririm :)
 
Son düzenleme:

xdd34

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
8
Reaksiyon puanı
0
Puanları
1
Yaş
23
Lan direkt yazakmı
 

xdd34

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
8
Reaksiyon puanı
0
Puanları
1
Yaş
23
aga obesite cıkıyo hep neden
 

NecimDurmaz

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
9
Reaksiyon puanı
0
Puanları
1
Yaş
21
son halini al kanka son halinde düzgün cıkıyor ılk hlaınde dönüşüm yapmamıştım
 

xdd34

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
8
Reaksiyon puanı
0
Puanları
1
Yaş
23
tamam hallettım
 

NecimDurmaz

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
9
Reaksiyon puanı
0
Puanları
1
Yaş
21
using System;

namespace MyApp // Note: actual namespace depends on the project name.
{
internal class Program
{
static void Main(string[] args)
{
int yas, kilo = 0;
float boy = 0;
Boolean devam = true;
int devam2 = 1;
Console.WriteLine("Lütfen yasinizi giriniz");
yas =Convert.ToInt32(Console.ReadLine());

try
{
do
{
if (yas >= 20)
{
Console.WriteLine("Lütfen kilo giriniz");
kilo =Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Lütfen boy giriniz");
boy =Convert.ToInt32(Console.ReadLine());

Console.WriteLine(VKIHesaplama(kilo, boy));

Console.WriteLine("Devam etmek istiyor musunuz? 1-Evet 2-Hayır");
devam2 =Convert.ToInt32(Console.ReadLine());
switch (devam2)
{
case 1: devam = true; break;
case 2: devam = false; break;
}
}
else
Console.WriteLine("Yas 20 ve üstü olmalıdır tekrar giriniz.");

} while (devam);

}
catch (FormatException hata)
{
Console.WriteLine("Yanlış formatta değer girildi tekrar giriniz.");

}
catch (Exception)
{

throw;
}

}
public static string VKIHesaplama(int kilo, float boy)
{
float boyvki = boy/100;
float vki = kilo/boyvki*boyvki;
if (vki>18.5 && vki < 30.0)
return vki >18.5 && vki <24.9 ? "Healthy weight " : "Over weight";
else if (vki>30)
return " obesity";
else return "underweight";
}
}
}
Mesaj otomatik birleştirildi:

try parse ile de yaptım githubtan bakın hangisini istiyosanız ikisi de doğru karışık yapın işte
 

cuhara10

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
4
Reaksiyon puanı
0
Puanları
1
Yaş
23
aga
githubdakini bulamadım buaraya atsana
Mesaj otomatik birleştirildi:

bi de hep obez çıkıyo
 

xdd34

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
8
Reaksiyon puanı
0
Puanları
1
Yaş
23
using System;

namespace BMI
{
internal class Program
{
static void Main(string[] args)
{
int age, weight = 0;
float size = 0;
Boolean contunie = true;
int contunie2 = 1;
Console.WriteLine("Please enter the age:");
age = Convert.ToInt32(Console.ReadLine());

try
{
do
{
if (age >= 20)
{
Console.WriteLine("please enter your weight:");
weight = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please enter the size");
size= Convert.ToInt32(Console.ReadLine());

Console.WriteLine(VKIHesaplama(weight, size));

Console.WriteLine("Do you want to continue? 1)) YES 2)) NO");

contunie2 = Convert.ToInt32(Console.ReadLine());
switch (contunie2)
{
case 1: contunie = true; break;
case 2: contunie= false; break;
}
}
else
Console.WriteLine("Age must be 20 and over, please enter again");

} while (contunie);

}
catch (FormatException error)
{
Console.WriteLine("WRONG FORMAT PLEASE TRY AGAIN!!!");

}
catch (Exception)
{

throw;
}

}
public static string VKIHesaplama(int weight, float size)
{
float boyvki = size/ 100;
Console.WriteLine(boyvki);
float vki = size / boyvki * boyvki;
if (vki > 18.5 && vki < 30.0)
return vki > 18.5 && vki < 24.9 ? "Healthy weight " : "Over weight";
else if (vki > 30)
return " obesity";
else return "underweight";
}
}
}



şöyle değiştrdim ing olarak yanlıs varmı?
 

p1cH4amsı

Öğrenci
Katılım
27 Kasım 2022
Mesajlar
1
Reaksiyon puanı
0
Puanları
1
Yaş
22
using System; namespace MyApp { internal class Program { static void Main(string[] args) { int yas, kilo=0, boy=0; Boolean devam = true; int devam2 = 1; Console.WriteLine("please enter your age"); yas =Convert.ToInt32(Console.ReadLine()); Console.WriteLine(yas); try { do { if (yas >= 20) { Console.WriteLine("Lütfen kilo giriniz"); kilo =Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Lütfen boy giriniz"); boy =Convert.ToInt32(Console.ReadLine()); Console.WriteLine(VKIHesaplama(kilo, boy)); Console.WriteLine("Devam etmek istiyor musunuz? 1-Evet 2-Hayır"); devam2 =Convert.ToInt32(Console.ReadLine()); switch (devam2) { case 1:devam = true; break; case 2:devam = false; break; } } else Console.WriteLine("Yas 20 ve üstü olmalıdır tekrar giriniz."); } while (devam); } catch (FormatException hata) { Console.WriteLine("Yanlış formatta değer girildi tekrar giriniz."); } catch (Exception) { throw; } } public static string VKIHesaplama(int kilo,int boy) { float vki = kilo/boy*boy; if (vki>18.5 && vki < 30.0) return vki >18.5 && vki <24.9 ? "Healthy weight " : "Over weight"; else if (vki>30) return " obesity"; else return "underweight"; } } }
 

NecimDurmaz

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
9
Reaksiyon puanı
0
Puanları
1
Yaş
21
using System;

namespace BMI
{
internal class Program
{
static void Main(string[] args)
{
int age, weight = 0;
float size = 0;
Boolean contunie = true;
int contunie2 = 1;
Console.WriteLine("Please enter the age:");
age = Convert.ToInt32(Console.ReadLine());

try
{
do
{
if (age >= 20)
{
Console.WriteLine("please enter your weight:");
weight = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please enter the size");
size= Convert.ToInt32(Console.ReadLine());

Console.WriteLine(VKIHesaplama(weight, size));

Console.WriteLine("Do you want to continue? 1)) YES 2)) NO");

contunie2 = Convert.ToInt32(Console.ReadLine());
switch (contunie2)
{
case 1: contunie = true; break;
case 2: contunie= false; break;
}
}
else
Console.WriteLine("Age must be 20 and over, please enter again");

} while (contunie);

}
catch (FormatException error)
{
Console.WriteLine("WRONG FORMAT PLEASE TRY AGAIN!!!");

}
catch (Exception)
{

throw;
}

}
public static string VKIHesaplama(int weight, float size)
{
float boyvki = size/ 100;
Console.WriteLine(boyvki);
float vki = size / boyvki * boyvki;
if (vki > 18.5 && vki < 30.0)
return vki > 18.5 && vki < 24.9 ? "Healthy weight " : "Over weight";
else if (vki > 30)
return " obesity";
else return "underweight";
}
}
}



şöyle değiştrdim ing olarak yanlıs varmı?
Do you want to continue yerine Do you want to try again? olabilir
devam etmiyor tekrardan baştan başlıyor diye ama siz bilirsiniz
Mesaj otomatik birleştirildi:

using System; namespace MyApp { internal class Program { static void Main(string[] args) { int yas, kilo=0, boy=0; Boolean devam = true; int devam2 = 1; Console.WriteLine("please enter your age"); yas =Convert.ToInt32(Console.ReadLine()); Console.WriteLine(yas); try { do { if (yas >= 20) { Console.WriteLine("Lütfen kilo giriniz"); kilo =Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Lütfen boy giriniz"); boy =Convert.ToInt32(Console.ReadLine()); Console.WriteLine(VKIHesaplama(kilo, boy)); Console.WriteLine("Devam etmek istiyor musunuz? 1-Evet 2-Hayır"); devam2 =Convert.ToInt32(Console.ReadLine()); switch (devam2) { case 1:devam = true; break; case 2:devam = false; break; } } else Console.WriteLine("Yas 20 ve üstü olmalıdır tekrar giriniz."); } while (devam); } catch (FormatException hata) { Console.WriteLine("Yanlış formatta değer girildi tekrar giriniz."); } catch (Exception) { throw; } } public static string VKIHesaplama(int kilo,int boy) { float vki = kilo/boy*boy; if (vki>18.5 && vki < 30.0) return vki >18.5 && vki <24.9 ? "Healthy weight " : "Over weight"; else if (vki>30) return " obesity"; else return "underweight"; } } }
bu yanlış kanka eskisi
Mesaj otomatik birleştirildi:

using System;

namespace MyApp // Note: actual namespace depends on the project name.
{
internal class Program
{
static void Main(string[] args)
{
int yas, kilo = 0;
float boy=0;
Boolean devam = true;
int devam2 = 1;
Console.WriteLine("Lütfen yasinizi giriniz");
yas =Convert.ToInt32(Console.ReadLine());

try
{
do
{
if (yas >= 20)
{
Console.WriteLine("Lütfen kilo giriniz");
kilo =Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Lütfen boy giriniz");
boy =Convert.ToInt32(Console.ReadLine());

Console.WriteLine(VKIHesaplama(kilo, boy));

Console.WriteLine("Devam etmek istiyor musunuz? 1-Evet 2-Hayır");
devam2 =Convert.ToInt32(Console.ReadLine());
switch (devam2)
{
case 1:devam = true; break;
case 2:devam = false; break;
}
}
else
Console.WriteLine("Yas 20 ve üstü olmalıdır tekrar giriniz.");

} while (devam);

}
catch (FormatException hata)
{
Console.WriteLine("Yanlış formatta değer girildi tekrar giriniz.");

}
catch (Exception)
{

throw;
}

}
public static string VKIHesaplama(int kilo,float boy)
{
float boyvki=boy/100 ;
float vki = kilo/boyvki*boyvki;
if (vki>18.5 && vki < 30.0)
return vki >18.5 && vki <24.9 ? "Healthy weight " : "Over weight";
else if (vki>30)
return " obesity";
else return "underweight";
}
}
}
 

cuhara10

Öğrenci
Katılım
26 Kasım 2022
Mesajlar
4
Reaksiyon puanı
0
Puanları
1
Yaş
23
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace bmihesaplama
{
internal class Program
{
static void Main(string[] args)
{
int yas, kilo = 0;
float boy = 0;
Boolean ilerle = true;
int ilerle2 = 1;
Console.WriteLine("Lütfen yasinizi giriniz");
yas = Convert.ToInt32(Console.ReadLine());

try
{
do
{
if (yas >= 20)
{
Console.WriteLine("Lütfen kilo giriniz");
kilo = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Lütfen boy giriniz");
boy = Convert.ToInt32(Console.ReadLine());

Console.WriteLine(VKIHesaplama(kilo, boy));

Console.WriteLine("Devam etmek istiyor musunuz? 1-Evet 2-Hayır");
ilerle2 = Convert.ToInt32(Console.ReadLine());
switch (ilerle2)
{
case 1: ilerle = true; break;
case 2: ilerle = false; break;
}
}
else
Console.WriteLine("Yas 20 ve üstü olmalıdır tekrar giriniz.");

} while (ilerle);

}
catch (FormatException hata)
{
Console.WriteLine("Yanlış formatta değer girildi tekrar giriniz.");

}
catch (Exception)
{

throw;
}

}
public static string VKIHesaplama(int kilo, float boy)
{
float boyvki = boy / 100;
float vki = kilo / (boyvki * boyvki);
if (vki > 18.5 && vki < 30.0)
return vki > 18.5 && vki < 24.9 ? "Healthy weight " : "Over weight";
else if (vki > 30)
return " obesity";
else return "underweight";
}
}
}
 
Üst