Question: This assignment asks you to create some small, simple C programs. They should only require the parts of C that you have learned in class

This assignment asks you to create some small, simple C programs. They should only require the parts of C that you have learned in class so far. If you find yourself reaching for something completely new to you that you found on the internet to solve these problems, stop; you're likely overcomplicating things (plus, copying code from the internet is cheating).
Each program should consist of the usual "main function mantra" that is necessary for every C program. Above that you might have some "#include"s. You will need to include to obtain access to things sqrt(), sin(), cos(), etc. andto get at printf().All the other code in your program should be inside the main function.
Make sure to compile your program using the "-Wall" and "-Wextra" flags with gcc and make sure that you don't declare yourself "done" before you've fixed all warnings too. In fact, just use the "-Werror" flag as well so that warnings will be treated like errors. Note that you may have to do a bit of research when solving these problems. This research should be focused on uncovering the necessary formulae to use, not to discover C code which solves the problem! Do search for "Fibonacci sequence"; don't search for "C code for Fibonacci sequence". Even if you don't end up copying the code and getting busted for cheating, evenjust seeing the codewhich solves the problem at hand will rob you of the learning experience in the exercise.
Program 1: fibonacci.c
Write a program which accepts a single integer number as a command line argument, we'll call itn. The program should then calculate and print thenthterm of the Fibonnaci sequence.
Make sure to guard against the possibility of the program being provided the wrong number of arguments and to have the program quit gracefully with some sort of explanation when that occurs. In fact,you should do this for all programs in this assignment.
Make sure to name your C file for this program "fibonacci.c".
Problem 2: temperature_chart.c
Write a program which accepts two or three real numbers as command line arguments. The first two numbers are a starting and a stopping temperature in degrees Fahrenheit and the third number is a "step" also in degrees Fahrenheit. The program should then output a chart showing Fahrenheit and Celsius temperatures according to the input (see example below). If no "step" argument is provided, then the program should default to a step of one degree Fahrenheit.
Tip: since the program expects real numbers as inputs, you won't be able to use "atoi()". Instead, declare your variables to be of type "double" instead of "int" and use the function "atof()" instead. It is also located in just like "atoi()".
Tip: for easier spacing between the temperatures, use "\t" inside your printf() strings to insert a character.
./temperature_chart 3221220
320.0
5211.11111111111111
7222.22222222222222
9233.333333333333336
11244.44444444444444
13255.55555555555556
15266.66666666666667
17277.77777777777779
19288.88888888888889
212100.0
Your decimal precision may vary from the example given here.
Make sure to name your C file for this program "temerature_chart.c".
Problem 3: jump_the_five.c
Consider the algorithm explained in the following image:
"When I get up, nothing gets me down."
-D. L. Roth
In an episode of the television show The Wire, drug dealers
assume the police are intercepting their text messages.
Whenever a phone number needs to be texted in the course
of a criminal conspiracy, the dealers will obfuscate the num-
ber. They use an algorithm we'll call "Jump the Five" because
each number is changed to its mate on the opposite of a US
telephone pad if you jump over the 5. In this exercise, we'll
discuss how to encrypt messages using this algorithm, and
then we'll see how to use it to decrypt the encrypted mes-
sages, you feel me?
If we start with the 1 button and jump across the 5, we get
to 9. The 6 jumps the 5 to become 4, and so forth. The num-
bers 5 and 0 will swap with each other.
Make sure to name your C file for this program "jump_the_five.c".
This assignment asks you to create some small,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!