Create a program that asks the user for the size of the array of fears and then integer inputs which represents a certain fear. Store these integer inputs in the array of fears you created after getting the size. Then, ask the user for the value of x which represents the fear of the stranger we're helping. Finally, go through the array of fears and check if the fear of the stranger is not in the array of fears. If it is not in there, print "You have nothing to worry about". Otherwise, just be silent...

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

4. Do I Have a Real Fear?

by CodeChum Admin

Shux, I'm starting to get back up but I feel like I'm scared. Life seems too overwhelming.

 

Wait, what are you saying? Are you saying I don't have to worry about anything because my fear is non-existent in an array of fears?

 

 

Instructions:

  1. Create a program that asks the user for the size of the array of fears and then integer inputs which represents a certain fear. Store these integer inputs in the array of fears you created after getting the size.
  2. Then, ask the user for the value of x which represents the fear of the stranger we're helping.
  3. Finally, go through the array of fears and check if the fear of the stranger is not in the array of fears. If it is not in there, print "You have nothing to worry about". Otherwise, just be silent...

Input

1. Size of the array of fears

2. Series of integer values representing the fears

3. Value of x representing the fear of the stranger

Output

 

Enter the size: 5
Enter fear #1: -3
Enter fear #2: 4
Enter fear #3: 10
Enter fear #4: 1
Enter fear #5: 15
Enter the value of x: 9
You have nothing to worry about
main.c
>
+ c
16
printf("Enter the value of x: ");
scanf("%d" ,&n);
17
18
19
while (n=f[i])
{
fear-f[i];
if(n==f[i])
{
printf("You have nothing to worry about");
break;
}
-f[i];
%3D
20
21 -
22
23
24
25
26
27
28
29
if(n!=f[i])
{
printf("%");
}
}
30
31
32
33
34
35
return 0;
37 }
36
Transcribed Image Text:main.c > + c 16 printf("Enter the value of x: "); scanf("%d" ,&n); 17 18 19 while (n=f[i]) { fear-f[i]; if(n==f[i]) { printf("You have nothing to worry about"); break; } -f[i]; %3D 20 21 - 22 23 24 25 26 27 28 29 if(n!=f[i]) { printf("%"); } } 30 31 32 33 34 35 return 0; 37 } 36
of the stranger
main.c
>
+ c
1
#include<stdio.h>
Output
3 - int mainO{
4
int n,i,ctr,fear,x,f[20];
ctr = n;
Enter the size: 5
Enter fear #1: -3
printf("Enter the size: ");
scanf("%d",&n);
Enter fear #2: 4
8
Enter fear #3: 10
9.
10
Enter fear #4: 1
11
for(i=1;i<=n;i++)
Enter fear #5: 15
12
printf("Enter fear #%d: ",i);
scanf("%i",&f[i]);
}
Enter the value of x: 9
13
You have nothing to worry about
14
15
16
printf("Enter the value of x: ");
scanf("%d",&n);
17
18
+ 567
Transcribed Image Text:of the stranger main.c > + c 1 #include<stdio.h> Output 3 - int mainO{ 4 int n,i,ctr,fear,x,f[20]; ctr = n; Enter the size: 5 Enter fear #1: -3 printf("Enter the size: "); scanf("%d",&n); Enter fear #2: 4 8 Enter fear #3: 10 9. 10 Enter fear #4: 1 11 for(i=1;i<=n;i++) Enter fear #5: 15 12 printf("Enter fear #%d: ",i); scanf("%i",&f[i]); } Enter the value of x: 9 13 You have nothing to worry about 14 15 16 printf("Enter the value of x: "); scanf("%d",&n); 17 18 + 567
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education