The value stored in the variable i = - 3
Then the variable k stores the value k = i % 2 = (-3) % 2 = -1 (First divide 3 by 2. The remainder is 1. But the first operand that is -3 has a negative sign so the result will be -1)
Since the variable k stores the value (-1), hence the output of the program when it is executed will be (The printf command is used to print the value of k)
- 1 .........................(Correct Answer)
QUESTIONS What will be the output of the following C code? 1. #include <stdio.h> int maino...
9. Which of the following is true for the following program? #include <stdio.h> int maino int i = 1; switch (0) case 1: printf("%d", 0); case 2: printf("%d", 0); case 3: printf("%d", 0); default: printf("%d", 1); return 0; } (2 points) The program has no error, the output is 1111 The program has no error, the output is 1 The program produces a compile time error, because there are no break statements The program produces a compile time error, because...
What is the functionality of the following code? #include #include mainO <stdio.h> <unistd.h> int i,j; j-0: printf ("Ready to fork.n) i-fork; if 0) this code.\n"); printf "The child executes for (i-0; i?5; i++) printf("Child j-dn".j); else j-vaito printf("The parent executes this code. Ln" printf ("Parent j-dn",j);
please help me asap 1 Determine the output for the following code: #include<stdio.h> int main static int num; fornum : ++ num: num++) -- printf("%d". num): if num ==8) break; [10] COI retum 1 b) #include<stdio.h> int main int test: fortest - 0: tests=5: test); printer test: retum
22. (6 points) Determine the output for the following coe # include < stdio.h > int main(void) ( int z 1, total -0, y printf(d , x) ) //end-for printf("The total %d\n", total) ) //end-main
Read the following code and fill the following blanks (no space is allowed): #include <stdio.h> int maino inta - 55: int*pa &a; "An integer" /* A pointer to an integer" int *ppa = &pa; /* A pointer to a pointer to an integer printf("The content of a is %d\n", printf("The address of a is %p\n", printf("The content of pa is %p\n", printf("The address of pa is %p\n", printf("The dereferenced value of pa is %d\n", printf("The content of ppa is pln",...
What is printed when the following code is executed? #include <stdio.h> int main() { for (int i=3, j=5; i>=0; i-=2, j+=j*i) { printf("%d", j); منم }
1. What is the output of the following program? include <stdio.h> int wilma (int x) if (x<5) x = 7; return (x) int main (void) int x-1 x=wilma (x) ; printf ("%d", x); return (0) b)3 c) 4 d) 7 a) 1 e) none of these
Question 3 Predict the output of the following C program: #include <stdio.h> void main() { int i = 0; for(; 1; i++){ printf("%d",i); if(i==7) break; } 12pt Paragraph 1 Β Ι Ο Αν και Ta
Q4) what is the output after the code below is executed? #include <stdio.h> #1 nclude<string.h> int main) char abc[100]-"Good Luck in Your Programming Final" int i, ; while(abc[i]!= '\0'){ if(abc[i]' if(abc[i+1]-'&&abci+1] -'0' else printf"c", abcli-1]) printf("\n w = %d return 0; \n", w); Place you answer here 4 l Page
Question 8 Predict the output of the following C program: 5 #include <stdio.h> void binaryCode(int n) printf("1"); if(n=2) return; binaryCode(n-1); int i = 0; for(; i<n;i++) printf("O"); binaryCode(n-2); } void main() { binaryCode(3); 12pt v Paragraph Β Ι Ο Avor T²v ...