دانلود رایگان پروژه دانشجویی

محاسبه ی فاکتوریل اعداد

پنجشنبه, ۲۱ خرداد ۱۳۹۴، ۰۹:۱۶ ق.ظ

برنامه: محاسبه ی فاکتوریل اعداد

 ++C

 

 

 

 #C

 

 #include
#include

main()
{
int num,fact=1;

cout<<"Enter number :";
cin>>num;

for(int i=2; i<=num ; i++)
fact = fact * i;

cout<<"Factorial of "<<num<<" is : "<<fact;

getch();
return 0;
}
   using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{

int num,fact=1;

num=Int32.Parse( textBox1.Text) ;

for(int i=2; i<=num ; i++)
fact = fact * i;

lbl1.Text = Convert.ToString(fact) ;




}
}
}


۹۴/۰۳/۲۱
hadi momene

نظرات  (۰)

هیچ نظری هنوز ثبت نشده است

ارسال نظر

ارسال نظر آزاد است، اما اگر قبلا در بیان ثبت نام کرده اید می توانید ابتدا وارد شوید.
شما میتوانید از این تگهای html استفاده کنید:
<b> یا <strong>، <em> یا <i>، <u>، <strike> یا <s>، <sup>، <sub>، <blockquote>، <code>، <pre>، <hr>، <br>، <p>، <a href="" title="">، <span style="">، <div align="">
تجدید کد امنیتی