What would be the possible output of the following C program?

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
be recor
#include<stdio.h>
#include<stdlib.h>
minutes
#include<time.h>
limit on
int func(int, int, int, int);
main(){
srand(time(NULL));
int a, b, c, fNum;
printf("Choose three different numbers between 0-39:");
scanf ("%d%d%d", &a, &b, &c);
fNum = func (a, b, c, 25);
printf("\nThe result: %d", fNum);
}
int func (int ul, int u2, int u3, int iter){
srand (time (NULL));
int n1=0, i=0, count=0;
for (;i<iter;i++){
n1 = rand()%39;
printf("%d ",n1);
if (n1==ul || n1==u2 || n1==u3)
count++;
return count;
}
What would be the possible output of the following C program?
O Choose three different numbers between 0-39:14 22 36
37 6 2 7 10 26 32 13 36 2 13 26 1 27 33 17 12 8 26 14 4 1 19 1 6
The result: 12
Choose three different numbers between 0-39:6 15 33
3 25 26 17 16 33 31 31 15 4 0 22 35 27 2 9 5 6 18 13 32 33 19 35 6
The result: 1
Choose three different numbers between 0-39:5 8 21
19 15 5 3 1 8 3 25 12 7 28 32 14 35 16 27 8 30 36 12 2 5 15 12 33
The result: 4
Choose three different numbers between 0-39:8 12 22
13 36 22 27 34 20 13 30 23 18 10 30 21 14 17 24 35 29 32 22 8 7 34 3 22
The result: 8
Transcribed Image Text:be recor #include<stdio.h> #include<stdlib.h> minutes #include<time.h> limit on int func(int, int, int, int); main(){ srand(time(NULL)); int a, b, c, fNum; printf("Choose three different numbers between 0-39:"); scanf ("%d%d%d", &a, &b, &c); fNum = func (a, b, c, 25); printf("\nThe result: %d", fNum); } int func (int ul, int u2, int u3, int iter){ srand (time (NULL)); int n1=0, i=0, count=0; for (;i<iter;i++){ n1 = rand()%39; printf("%d ",n1); if (n1==ul || n1==u2 || n1==u3) count++; return count; } What would be the possible output of the following C program? O Choose three different numbers between 0-39:14 22 36 37 6 2 7 10 26 32 13 36 2 13 26 1 27 33 17 12 8 26 14 4 1 19 1 6 The result: 12 Choose three different numbers between 0-39:6 15 33 3 25 26 17 16 33 31 31 15 4 0 22 35 27 2 9 5 6 18 13 32 33 19 35 6 The result: 1 Choose three different numbers between 0-39:5 8 21 19 15 5 3 1 8 3 25 12 7 28 32 14 35 16 27 8 30 36 12 2 5 15 12 33 The result: 4 Choose three different numbers between 0-39:8 12 22 13 36 22 27 34 20 13 30 23 18 10 30 21 14 17 24 35 29 32 22 8 7 34 3 22 The result: 8
Expert Solution
steps

Step by step

Solved in 3 steps with 1 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