please help me answer this c programing question


C PROGRAM
#include <stdio.h>
int cal_plant(int num_month);
int main(void)
{
int month =20;
int plant;
//calling a function and passing the parameter
plant = cal_plant(month);
//printing the statement
printf("after %d months,there will be %d
plants",month,plant);
return 0;
}
//called function from main function
int cal_plant(int num_month)
{
//varaiable declaration
int i = 9,plant =2 ;
//checks the condition if entered month is less than 4 it means no
full grown tree
if(num_month<4)
{
//return 0
return 0;
}
//checks the condition if month is greater than 4 and equals to 8
then 2 fully grown tree
else if(num_month>=4 && num_month ==8)
{
//return 2
return plant;
}
//runs the loop if month is greater than 8
//loop runs from 9 to entered month(inclusive)
//from the given question we can observe that from 9 month onwards
there will one fully grown tree
//so increment of plat ie., tree
for(i=9;i<=num_month;i++)
{
//increment of plant
plant++;
}
//return the plant
return plant;
}


OUTPUT


please help me answer this c programing question Q2: Complete the given program by implementing the...
Please draw a flow chart for each method please and thank
you.
Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, and output all integers less than or equal to that value. Assume that the list will always contain less than 20 integers. Ex: If the input is: 5 50 60 140 200 75 100 the...
This program will use the Random class to generate random temperatures (integers) between some minimum (inclusive) and some maximum (inclusive) values. You will need to calculate the minimum and maximum given a starting temperature integer and a possible change in temperature integer. (1) Copy the following method stub into your Temperature Predictor class and complete it according to the specifications described in the header comments. * Generates a random temperature (int) within a range when given the current temperature *...
Can anyone help me to complete this C plus plus program? Please notice: You are required to implement insertion sort by using smart pointer. Please notice: You are required to implement insertion sort by using smart pointer. Please notice: You are required to implement insertion sort by using smart pointer. Please notice: You are required to implement insertion sort by using smart pointer. Please notice: You are required to implement insertion sort by using smart pointer. //Implment insertion sort using...
C++
code... Need help asap
QUESTION 2 (20 MARKS) The following program shows a simple example to calculate average of three marks. Explain how the program is working as well as data management in your memory. You can illustrates this by using table or drawing. The sample output is illustrated in Figure Q2. 1 #include <iostream> 2 using namespace std 3 float calculateAverage (int* marks) int sum=0; float average, for (int İzd ;ia;i++) sumesum+( (marks+i)12 10 11 average float (sum)...
Hi this is C++, I'm really struggle with it please help me.... ************************ Here is the original high score program,: Write a program that records high-score data for a fictitious game. The program will ask the user to enter five names, and five scores. It will store the data in memory, and print it back out sorted by score. The output from your program should look exactly like this: Enter the name for score #1: Suzy Enter the score for...
PLEASE HELP ME WITH THIS TASK 3.1 (FLOWCHART)
AND TASK 3.2 (SOURCE PROGRAM). THANK YOU!
Given below is a partially completed C program, which you will use as a start to complete the given tasks. #define SIZE 9 #include <stdio.h> int compareAndCount (int[], int[]); double averageDifference (int[], int[]); void main() { } int compareAndCount(int arr1[SIZE], int arr2[SIZE]) { int count = 0; for (int i = 0; i < SIZE; i++) { if (arri[i] > arr2[i]) count++; } return count;...
%%%%% c++ assignment %%%%%% ///////// please test your program and check for errors. //////// you should use the file bellow For this assignment you will write a program that creates a tree of "plants". Each plant is the result of an exeperiment. I have provided the main driver program that is responsible for running each of the experiments but you will need to create a tree for storing the results. The objective of this assignment is to learn how to...
Write a complete C++ program that defines the following class: Class Salesperson { public: Salesperson( ); // constructor ~Salesperson( ); // destructor Salesperson(double q1, double q2, double q3, double q4); // constructor void getsales( ); // Function to get 4 sales figures from user void setsales( int quarter, double sales); // Function to set 1 of 4 quarterly sales // figure. This function will be called // from function getsales ( ) every time a // user enters a sales...
I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME
OUT AND READ THIS. I just have to explain a lot so you understand
how the program should work.
In C programming, write a simple program to
take a text file as input and encrypt/decrypt it by reading the
text bit by bit, and swap the bits if it is specified by the first
line of the text file to do so (will explain below, and please let
me...