С точки зрения синтаксиса языка C# правильным будет выражение
(Отметьте один правильный вариант ответа.)
Варианты ответа
using System;class Example{ static void Main() { double[] a = new double[] { 8.3, 11.6 - 4.8, 23.11, 54.03, 26.8, 9.4 }; int n = sizeof(a)/sizeof([0]); string str; int i; double sum = 0; for (i = 0; i < n; i++) { sum += a[i]; } str = "Сумма массива равна " + sum; Console.WriteLine(str); Console.WriteLine("Нажмите любую кнопку!"); Console.ReadKey(); }}
using System;class Example{ static void Main() { double a[] = { 8.3, 11.6 - 4.8, 23.11, 54.03, 26.8, 9.4 }; int n = a.Length; string str; int i; double sum = 0; for (i = 0; i < n; i++) { sum += a[i]; } str = "Сумма массива равна " + sum; Console.WriteLine(str); Console.WriteLine("Нажмите любую кнопку!"); Console.ReadKey(); }}
using System;class Example{ static void Main() { double[] a = new double[] { 8.3, 11.6 - 4.8, 23.11, 54.03, 26.8, 9.4 }; int n = a.Length; string str; int i; double sum = 0; for (i = 0; i < n; i++) { sum += a[i]; } str = "Сумма массива равна " + sum; Console.WriteLine(str); Console.WriteLine("Нажмите любую кнопку!"); Console.ReadKey(); }} (Верный ответ)
using System;class Example{ static void Main() { double[] a = double[] { 8.3, 11.6 - 4.8, 23.11, 54.03, 26.8, 9.4 }; int n = a.Length; string str; int i; double sum = 0; for (i = 0; i < n; i++) { sum += a[i]; } str = "Сумма массива равна " + sum; Console.WriteLine(str); Console.WriteLine("Нажмите любую кнопку!"); Console.ReadKey(); }}
#include<iostream>#include<math.h>using namespace std;void main(){ double a[]={8.3,11.6-4.8,23.11,54.03,26.8,9.4}; int n=sizeof(a)/sizeof(a[0]); int i; double sum=0; for(i=0;i<n;i++) { cout<<"\na["<<i<<"] = "<<a[i]; sum+=a[i]; } cout<<"\nsum = "<<sum;}
<html><script type="text/javascript"> var i,n,sum,str; a = new Array(8.3,11.6-4.8,23.11,54.03,26.8,9.4); n = a.length; str=""; sum = 0; for (i = 0; i < n; i++) { str+="a["+ i + "] = " + a[i] + "<br>"; sum += a[i]; } str+= "Сумма массива равна " + sum ; document.write(str);</script></html>