1. Anasayfa
  2. Visual Studio C#

Visual Studio C# Dersleri – Dizi index numarasına göre toplam, faktöriyel ve kuvvet

Visual Studio C# Dersleri – Dizi index numarasına göre toplam, faktöriyel ve kuvvet
0

Eleman sayısı belirtilen a1, a2, a3 ve a4 dizileri için:
1- a1 dizisinin her bir elemanı kendi indexine eşit
2- a2 dizisinin her bir elemanı bulunan indexe kadar olan sayıların toplamı
3- a3 dizisinin her bir elemanı bulunan indexin faktöriyeli
4- a4 dizisinin her bir elemanı bulunan indexin kendi kuvvetini bulan program

int boyut;
Console.Write("Boyut Belirtin:");
int.TryParse(Console.ReadLine(), out boyut);
int[] a1 = new int[boyut];
int[] a2 = new int[boyut];
int[] a3 = new int[boyut];
int[] a4 = new int[boyut];
for (int i = 0; i < boyut; i++)
{
a1[i] = i;
a3[i] = 1;
a4[i] = 1;
for (int j = 1; j <= i; j++)
{
a2[i] += j;
a3[i] *= j;
a4[i] *= i;
}
}
Console.WriteLine("----------------------------");
Console.WriteLine("i :i+ :i! :i^i ");
Console.WriteLine("----------------------------");
for (int i = 0; i < boyut; i++)
{
Console.WriteLine("{0,-5}:{1,-5}:{2,-8}:{3,-10}", a1[i], a2[i], a3[i], a4[i]);
}
Console.ReadLine();
Bu İçeriğe Tepkin Ne Oldu?
  • 0
    ba_ar_l_
    Başarılı
  • 0
    gayet_yi
    Gayet İyi
  • 0
    te_ekk_rler
    Teşekkürler
  • 1
    anlamad_m
    Anlamadım
  • 0
    yetersiz
    Yetersiz
Subscribe
Bildir
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Yorum
Inline Feedbacks
View all comments