Question: 1. Write a C program that will calculate the voltage for an experiment that will be carried out repeated using an ac voltage signal. The
1. Write a C program that will calculate the voltage for an experiment that will be carried out repeated using an ac voltage signal. The signal is to have one of three values, depending on the time since the beginning of the experiment: For time t 10.0, volts(t) = sin(10.0).
1) Name your program voltage.c.
2) The program will calculate the voltage starting at time 0 until the time reaches 12. Increment the time by 0.5 for each calculation of the voltage.
3) Use a for loop.
4) Use the math library function sin(x) to compute sin(x). You will need to include the system header file math.h.
5) On Unix you will need lm in your command line to tell the Linker to search the math library when you compile. gcc -Wall -lm voltage.c
6) The formatted output should look like the following. The time and voltage should display two digits after the decimal point. time (sec) voltage
0.00 0.00
0.50 0.42
1.00 0.84
1.50 1.00
2.00 0.91
2.50 0.60
3.00 0.14
3.50 -0.35
4.00 -0.76
4.50 -0.98
5.00 -0.96
5.50 -0.71
6.00 -0.28
6.50 0.22
7.00 0.66
7.50 0.94
8.00 0.99
8.50 0.80
9.00 0.41
9.50 -0.08
10.00 -0.54
10.50 -0.54
11.00 -0.54
11.50 -0.54
12.00 -0.54
2. Write a C program that takes a message entered by the user, remove all punctuation (nonletters) except white spaces, bring all letters to uppercase, and then print the message. For example, with the input I came, I saw, I conquered! the output text should be I CAME I SAW I CONQUERED
1) Name your program remove.c.
2) Assume the input only contains punctuation and letters and does not contain digits.
3) The user input ends with the user pressing the enter key (a new line character).
4) You can use character handling functions such as toupper and isalpha. Dont forget to include ctype.h if you use any character handling functions.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
