using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication13
{
class Program
{
static void Main(string[] args)
{
Console.Write("panjang array : ");
int q = int.Parse(Console.ReadLine());
int[] a = new int[q];
int r=0;
for (int i = 1; i <= q; i++)
{
Console.Write("a[{0}] = ",i);
a[i-1]=int.Parse(Console.ReadLine());
r=r+a[i-1];
}
Console.WriteLine("total = {0}",r);
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication13
{
class Program
{
static void Main(string[] args)
{
Console.Write("panjang array : ");
int q = int.Parse(Console.ReadLine());
int[] a = new int[q];
int r=0;
for (int i = 1; i <= q; i++)
{
Console.Write("a[{0}] = ",i);
a[i-1]=int.Parse(Console.ReadLine());
r=r+a[i-1];
}
Console.WriteLine("total = {0}",r);
}
}
}
menghitung apa sih nich???? ane kok gk mau???
ReplyDeletenii untuk menghitung jumlah semua elemet dalam bahasa c#.
ReplyDelete