C Languagge: 1. What will be printed from the following program segments? (5 points each) a. for (int x = 1; x <= 20; x++) { for (int y=1; y<=5; y++) printf("%d", x); printf("\n"); } //for b. for (int x = 20; x >= 1; x--) { printf("%d\n", x); x-- } //for c. x = 12; do { printf("%d\n", x); x--; }while (x<7);
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
C Languagge:
1. What will be printed from the following program segments? (5 points each)
a. for (int x = 1; x <= 20; x++)
{
for (int y=1; y<=5; y++)
printf("%d", x);
printf("\n");
} //for
b. for (int x = 20; x >= 1; x--)
{
printf("%d\n", x);
x--
} //for
c. x = 12;
do
{
printf("%d\n", x);
x--;
}while (x<7);
2. What is the output of the following program segment? (5 points each)
a.
int count =0;
while (count++ < 10)
printf("This loop can repeat statements\n");
b.
int count =5;
while (--count > 0)
printf("\t%d",count);
3. Assume that the following code is correctly inserted into a program: ( 5 points
each)
int s = 0;
for (i = 0; i < 5; i++)
{
s = 2 * s + i;
printf("%d\n", s);
}
a. What is the final value of s?
b. If a semicolon is inserted after the right parenthesis in the for loop
statement,what is
the final value of s?
c. If the 5 is replaced with a zero in the for loop control expression, what is
the final value of s?
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images