Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 LAB EXERCISE - 2B Convert the following programs to Java or C/C++ code. The red text is the information about the statements. After you
1 LAB EXERCISE - 2B Convert the following programs to Java or C/C++ code. The red text is the information about the statements. After you finish copy/paste your codes in a word document and upload it to the system. information about the code array definition, size 99, name Int_list integer variable definition input from keyboard same as FOR loop 1) Fortran 95 Example program ! Input: An integer, List_Len, where List_Len is less ! than 100, followed by List_Len-Integer values ! Output: The number of input values that are greater ! than the average of all input values Implicit none Integer Dimension(99) :: Int_List Integer :: List_Len, Counter, Sum, Average, Result Result=0 Sum = 0 Read *, List_Len If ((List_Len > 0) .AND. (List_Len Average) Then Result = Result + 1 End If End Do ! Print the result Print *, 'Number of values > Average is:', Result Else Print *, 'Error - list length value is not legal' End If End end of loop output to monitor 2) COBOL IDENTIFICATION DIVISION. PROGRAM-ID. IDEONE. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 n PIC Z9. variable definition, interger, namen 1 PROCEDURE DIVISION. ACCEPT n PERFORM UNTIL n = 24 DISPLAY n ACCEPT n END-PERFORM. STOP RUN. input from keyboard same as WHILE loop output to monitor 3) ADA with Ada.Text_IO; use Ada.Text_10; with Ada. Integer_Text_IO; use Ada. Integer_Text_IO; procedure Test is subtype Small is Integer range 0..99; Input : Small; begin loop infinite loop input from keyboard Get(Input); if Input = 24 then exit; else Put (Input); New_Line; end if: output to monitor end loop; end; 4) PASCAL program ideone; var x: integer; s:integer; begin X:=7; S:=0; repeat S:=S+x; X:=X-1; until x=0; writeln(s); end. 1 output to monitor 5) C# using System; public class Test { 2 public static void Main() { int n; while ((n = int.Parse(Console.ReadLine()))!=42) Console.WriteLine(n); input from keyboard output to monitor } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started