برنامه: محاسبه ی فاکتوریل اعداد
++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) ;
} } } |
:: موضوعات مرتبط:
پروژه #c ,
پروژه طراحی الگورتم ,
,