Output and Debugging Questions (10 marks each) [20 Marks] Note: Provide a copy of the code...

80.2K

Verified Solution

Question

Programming

Output and Debugging Questions (10 marks each) [20 Marks]
Note: Provide a copy of the code and screen shot for the output inthe solutions’
1. Trace the following program and write the exact output for thefollowing inputs.
Explain each output. [10 Marks]
a. Input of an array { 20, 80 , 63, 89 }
b. Input of an array { 1, 2 ,3, 4}
c. Input of an array { 100, 200 ,300, 400}
d. Input of an array { -8, -9, -10, -11} ( Negative numbers)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
int[] M = new int[4] ;
for (int i = 0; i <4; i++)
{
M[i] = Int32.Parse(Console.ReadLine());
}
for (int i = 0; i < M.Length; i++)
{
M[i] = M[i] + 10;
Console.Write((M[i] / 3) + \" \");

}
Console.ReadKey();
}
}
}

Answer & Explanation Solved by verified expert
4.4 Ratings (770 Votes)
HiPlease see the output and explanation of each outputInput 20 80 63 89 For loop in the code will executeshow the output for each inputarray elementFor the first element 20Mi Mi 10 here First element willbecome 30 and then Mi 3 itwill become 303 10For the second element 80Mi Mi 10 here First element willbecome 90 and then Mi 3 itwill become 903 30For the third element 63Mi Mi 10 here First element willbecome 73 and then Mi 3 itwill become 733 24 As this is Integer array sothe output 2433 will be show as 24For the fourth element 89Mi Mi 10 here First element willbecome 99    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students