Write a program to output the following
**********
*. *
* PYTHON *
*. *
**********
#include <stdio.h>
#include <stdlib.h>
// This is where the parentheses are stored in memory
char buffer[1024];
char stack_pop();
void stack_push(char ch);
int stack_size();
int main(){
FILE *fp;
// The parentheses sequences is in the parentheses.txt file.
fp=fopen("parentheses.txt","r");
if(fp==NULL){
printf("The input file does not exist.\n");
exit(-1);
}
// Read the parenthese sequences into buffer array.
fgets(buffer,1024,fp);
//printf("%s",buffer);
}
// The pop operation in the stack. To be done.
char stack_pop(){
return ')';
}
// The push operation in the stack. To be done.
void stack_push(char ch){
}
// The number of elements in the stack. To be done.
int stack_size(){
return 0;
}
Divide 100 by 33. Produce the answer AND the remainder as shown in the output below.
Both numbers shown above should be stored in variables, BUT the calculations should be done in the output statements. Create variables to store results for this particular exercise. I want you to explore the different ways to do math in this HW. That being said, make sure the two variables with the numbers are referenced in the output.
OUTPUT:
100 divided by 33 equals 3, with a remainder of 1
Store a student’s four exam scores: 95, 87, 90, 89
Calculate and store the sum of those four test score.
Calculate and store the average of these scores.
Display the sum and average as shown below:
OUTPUT:
The sum of your scores is: 361
The average of your scores is: 90.25
Add the even numbers between 0 and any positive integer number given by the user.
Write a one-line program to output the following haiku.
A lightning flash:
between the forest trees
I have seen water.
Shiki
2. By studying the oscillations of a simple pendulum, the acceleration of free fall g on the surface of a planet is determined. For this purpose the formula serves: T = 2 × pi kat the square root of l / g, where T is the period of oscillations and l - the length of the pendulum. Experimental measurements performed on the Earth show that the total time for one hundred oscillations of the pendulum with length I = 1 m is t = 200 S. a) Calculate the acceleration of free fall on the surface of the Earth. b) Calculate the radius of the Earth, knowing that its mass is M = 6 × 10²⁴ kg. Dihet range = 6.67 × 10 ‐ ¹¹ Nm² / kg²
Write an application that displays the factorial for every integer value from 1 to 10. A factorial of a
number is the product of that number multiplied by each positive integer lower than it. For
example, 4 factorial is 4 * 3 * 2 * 1, or 24.
1. Create an array of size 100 and assign some random number from 0 to 50 in it using rand() and Srand() function(your lab instructor will tell you about these functions).
Note: (Assume index number +5) is roll number of student. For example
45
50
34
1
23
45 are marks of Roll # L1F20BSCS5
34 are marks of Roll# L1F20BSCS7
2. Find the index of maximum point and print the roll# along with message “Winner” Note: (don’t use sorting code here)
3. Find the index of 2nd maximum points (using 1st maximum points) and print the roll# along with message “Runner up”
Note: (don’t use sorting code here)
4. Calculate average of array i.e., Sum of all points in array and divide them by size of array
5. Check if its lower than 25 or not? and print appropriate message on screen.
6. Create a new array of similar size and copy all numbers in new array. Now sort the new array in descending order and print all values
Challenge: Print the roll# of students having similar points
Sample Output:
Student_Points : 5 21 0 23 10 5
Student L1F20BSCS8 is Winner
Student L1F20BSCS6 is Runner up
Average of Students points are: 12.8
Average of points is below 25; hence participants are not good programmers
Students points in order are: 23 21 5 5 0
What is memory leak, and dangling pointer?