same as WHILE loop output to monitor PERFORM UNTIL n = 24 DISPLAY n АССЕРТ п END-PERFORM. STOP RUN. 3) ADA with Ada Text JO: uuse Ada Text I0:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
PROCEDURE DIVISION.
input from keyboard
same as WHILE loop
output to monitor
АССЕРТ п
PERFORM UNTIL n = 24
DISPLAY n
АССЕРТ п
END-PERFORM.
STOP RUN.
3) ADA
with Ada.Text IO; use Ada. Text IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Test is
subtype Small is Integer range 0.99;
Input : Small;
begin
infinite loop
input from keyboard
loop
Get(Input);
if Input = 24 then
exit;
else
Put (Input):
New_Line;
output to monitor
end if;
end loop;
end;
4) PASCAL
program ideone;
var x: integer; s:integer;
begin
x:=7;
S:=0;
repeat
1
S:=S+X;
X:=x-1;
until x=0;
writeln(s):
output to monitor
end.
5) C#
using System;
public class Test
{
2
public static void Main(
{
int n;
while (n = int.Parse(Console.ReadLine())!=42) input from keyboard
output to monitor
Console.WriteLine(n);
}
Transcribed Image Text:PROCEDURE DIVISION. input from keyboard same as WHILE loop output to monitor АССЕРТ п PERFORM UNTIL n = 24 DISPLAY n АССЕРТ п END-PERFORM. STOP RUN. 3) ADA with Ada.Text IO; use Ada. Text IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure Test is subtype Small is Integer range 0.99; Input : Small; begin infinite loop input from keyboard loop Get(Input); if Input = 24 then exit; else Put (Input): New_Line; output to monitor end if; end loop; end; 4) PASCAL program ideone; var x: integer; s:integer; begin x:=7; S:=0; repeat 1 S:=S+X; X:=x-1; until x=0; writeln(s): output to monitor end. 5) C# using System; public class Test { 2 public static void Main( { int n; while (n = int.Parse(Console.ReadLine())!=42) input from keyboard output to monitor Console.WriteLine(n); }
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.
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
information about the code
array definition, size 99, name Int list
integer variable definition
Result= 0
Sum = 0
input from keyboard
Read *, List_Len
If ((List_Len > 0) .AND. (List_Len < 100)) Then
! Read input data into an array and compute its sum
Do Counter = 1, List_Len
same as FOR loop
Read *, Int_List(Counter)
Sum = Sum + Int List(Counter)
End Do
end of loop
! Compute the average
Average = Sum / List_Len
! Count the values that are greater than the average
Do Counter = 1, List_Len
If (Int_List(Counter) > Average) Then
Result = Result + 1
End If
End Do
! Print the result
Print *, 'Number of values > Average is:', Result
output to monitor
Else
Print *, 'Error - list length value is not legal"
End If
End
2) COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID. IDEONE.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 n PIC Z9 .
variable definition, interger, name n
1
Transcribed Image Text: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. 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 information about the code array definition, size 99, name Int list integer variable definition Result= 0 Sum = 0 input from keyboard Read *, List_Len If ((List_Len > 0) .AND. (List_Len < 100)) Then ! Read input data into an array and compute its sum Do Counter = 1, List_Len same as FOR loop Read *, Int_List(Counter) Sum = Sum + Int List(Counter) End Do end of loop ! Compute the average Average = Sum / List_Len ! Count the values that are greater than the average Do Counter = 1, List_Len If (Int_List(Counter) > Average) Then Result = Result + 1 End If End Do ! Print the result Print *, 'Number of values > Average is:', Result output to monitor Else Print *, 'Error - list length value is not legal" End If End 2) COBOL IDENTIFICATION DIVISION. PROGRAM-ID. IDEONE. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 n PIC Z9 . variable definition, interger, name n 1
Expert Solution
steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY