السلام عليكم ورحمة الله وبركاته
program calculate and print the factorial
الوصف :
برنامج يحسب المضروب لأي لعدد يقوم المستخدم بإدخاله بإستخدام whail loop and if بلغة c # هذا الكود
program calculate and print the factorial
الوصف :
برنامج يحسب المضروب لأي لعدد يقوم المستخدم بإدخاله بإستخدام whail loop and if بلغة c # هذا الكود
- الكود:
int f = 1;// gooree tabuk
int n;
Console.WriteLine("inter the number ");
n = Convert.ToInt32(Console.ReadLine());
if (n == 0)
{
f = 1;
}
while (n > 0)
{
f = f * n;
n = n - 1;
}
Console.WriteLine("factorial={0}",f);