پاسخ ها ( ۶ )

  1. Console.WriteLine(“enter number”);
    int number = Convert.ToInt32(Console.ReadLine());
    int i, sum = 0;
    int zarb = 1;

    for (i = 0; i < number; i++)
    {
    sum += i;
    zarb *= i;
    }

    Console.WriteLine("sum is: " + sum);
    Console.WriteLine("zarb is: " + zarb);

  2. long num,i,sum=0,haselZarb=1;
    Console.WriteLine(“pls enter your number:”);
    num = int.Parse(Console.ReadLine());
    for(i=1; i<= num; i++)
    {
    sum += i;
    haselZarb *= i;
    }
    Console.WriteLine("majmooAdad ={0} & haselZarb={1}", sum, haselZarb);

    بهترین پاسخ
  3. سلام

     

  4. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace ConsoleApplication2
    {
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine(“enter number:”);
    int n = Convert.ToInt32(Console.ReadLine());
    while (n > 0)
    {
    int zarb = 1;
    int sum = 0;
    for (int i = 1; i <=n; i++)
    {
    sum += i;
    zarb *= i;
    }
    Console.WriteLine(“sum:”+sum);
    Console.WriteLine(“zarb:”+zarb);
    Console.ReadKey();
    }
    }
    }
    }

  5. {//حاصل جمع وضرب از صفر تا عدد ورودی
    Console.WriteLine(“enter number”);
    int number = Convert.ToInt32(Console.ReadLine());
    int i,sum=0;
    int z = 1;

    for (i = 0; i < number; i++)
    {
    sum += i;
    z *= i;
    }

    Console.WriteLine("sum is: " + sum);
    Console.WriteLine("multiplication is: " + z);
    Console.ReadKey();
    }

  6. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace Darsman_forum3
    {
    class Program
    {
    static void Main(string[] args)
    {
    Console.Write(“Enter Number: “);
    int sum = 0, zarb = 1;
    int num = Convert.ToInt32(Console.ReadLine());
    for (int i = 1; i <= num; i++)
    {
    sum += i;
    zarb *= i;
    }
    Console.WriteLine(“Sum is: “+sum);
    Console.WriteLine(“Zarb is: “+zarb);
    }
    }
    }

ارسال یک پاسخ