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:
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...
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);
}](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa957b4ce-89ba-4bb4-a5b8-0ddd81a1815a%2F7d6b5c03-b782-40e5-a4b2-3928eb5ba998%2F6siq1d6_processed.jpeg&w=3840&q=75)
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa957b4ce-89ba-4bb4-a5b8-0ddd81a1815a%2F7d6b5c03-b782-40e5-a4b2-3928eb5ba998%2Fzd4qsfo_processed.jpeg&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 5 steps with 5 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
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](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY