ANSWER:-
#include <stdio.h>
void printsum(int a,int b)
{
int result=a+b;
if(result>0)
{
printf("positive number : %d",result);
}
else if(result<0)
{
printf("Negative number : %d",result);
}
else
{
printf("eqaul zero : %d",result);
}
}
int main() {
int a,b;
a=10;
b=-12;
printsum(a,b);
return 0;
}
// output
Negative number : -2
when input a=5 and b=6 then output is positive number : 11
when input a=5 and b=-5 then output is equal zero : 0
// if any doubt please comment
Provide test-cases to ensure 100% Statement Coverage. Provide actual values in your test-cases. printSum(int a, int...
please provide these functions.
int d_recursive(int n)
{
}
int d_iterative(int n)
{
}
For the function din the accompanying p1.cpp file) (a) (10 points) a recursive implementation and (b) (10 points) an iterative implementation ) = (n-1)ld(n-1) + d(n-2)], n > 3, where d(1) 0 and d(2-1, provide (in
Solve using C programming
3. lf you are given this code. #include <stdio.h> int main() int var1, var2; int sum; printf("Enter number 1:\n "); scanf("%d",&var1); printf("Enter number 2:In ); scanf("%d",&var2); sum-var1+var2; printf ("Vnsum of two entered numbers : %d", //printf ("Output: %d", res); sum); return e; Modify this code by creating a function called "addition". Make the arguments of the functions numberl and number 2. Add the two values in the function. Return a value called "result". Print "result" in...
1) Fix the Function #include <iostream> void print Num() { std::cout << number; }; int main() { int number = 35; printNum (number); return 0; (Give two ways to fix this code. Indicate which is preferable and why.) #include <iostream> void double Number (int num) {num = num * 2;} int main() { int num = 35; double Number (num); std::cout << num; // Should print 70 return 0; (Changing the return type of doubleNumber is not a valid solution.)
Consider the following code: int w- 10; while (w>0) scanf("%d", &y); if(y>0){ V++i else The value stored in variable v at the end of the execution of the loop could best be described as the sum of all positive numbers scanned from the terminal the number of times the loop executed the sum of all non-positive numbers scanned from the terminal the number of positive integers scanned from the terminal the number of negative integers scanned from the terminal
Define a type which comprises a struct called
"Maxima". In this struct contains
two int values a
and b. The purpose of this struct is to store
the largest two int values among a set of
integers. The value a is the largest number and
the value b is the second largest number. In order
to accomplish this task, you need to write the following
functions:
allzero( struct pointer ): This function sets
a and b values in a given...
> 9.9, based on a random sample of 71 observations drawn from a Test the null hypothesis Ho: M=9.9against the alternative hypothesis HA: normally distributed population with Z = 4.1 and 0 = 0.89. a) What is the value of the test statistic? Give your response to at least 3 decimal places. Number b) What is the appropriate p-value? Give your response to at least 3 decimal places. Number c) Is the null hypothesis rejected at: i) the 10% level...
5. We wish to conduct a hypothesis test of the form Ho : μ1-2-0 vs Ha : μί-μ2 > 0. Both populations are assumed normal with equal variance and samples are assumed independent. We draw 15 observations for the first sample and 17 observations for the second sample. State the distribution of the test statistic for this test. (a) t-distribution with 32 degrees of freedom (b) t-distribution with 30 degrees of freedom (e) Normal distribution with 30 degrees of freedom...
3. Consider a function F(t) which is zero for negative t, and takes the value exp(-t/2 ) for > 0. Find its Fourier transforms, C(w) and S(w), defined in 200 F(t) = C(w) cos(wt) dw + Sw) sin(wt) do. J-00 J-00 [Hint: Use Euler's theorem.] 4. Demonstrate that Sr?)dt = 2* ["icºw) +8?(]dio, J-00 J-00 where the relation between F(t), C(w), and S(w) is defined above. This result is known as Parseval's theorem.
please write the procedure how you got the answer 30 and 31
Use the program below for problems 30 - 31 #include<stdio.h> int calcfactorial (int, int, int); int main() printf("result: %d\n", calcfactorial (7, 2, 5)); return(0); int calcfactorial(int n, int a, int b) int fact = 1; if(n > 1) if (n >= a && n <= b) fact = n* calcfactorial(n - 1, a, b); else fact = calcfactorial(n - 1, a, b); return(fact); 30. Which of the following...
Using matlab and if/else statement please!
Write a function that determines the real roots of a quadratic equation ax2 + bx + c = 0. To calculate the roots of the equation, the function calculates the discriminant D, given by: D = b2-4ac If D> 0, the code should display "The equation has two roots" and print the values on a new line. If D 0, the code should display "The equation has one root.", and print the value on...