Follow Me

Program output exercises in C Programming in C

  • Program output: Give the output on the screen of the following program (indicate a space using this symbol _): #include<stdio.h>double mystery(int A[], int i){     i = A[i] * 2;     A[0] = 0;     return i+1;} int main(){     int i = 8, j = 5, k, A[...
  • Program output 1: Give the output on the screen of the following program #include <stdio.h>int main(){     int x;     x = -3 + 4 * 5 -6; printf("%d\n",x);     x = 3 + 4 % 5 -6; printf("%d\n",x);     x = -3 * 4 % -6 / 5 ; printf("%d\n",x);     x = ...
  • Program output 2: Give the output on the screen of the following program #include <stdio.h>int main(){    int x = 3, y , z;     x*= 2 + 1; printf("%d\n",x);     x *= y = z = 3; printf("%d\n",x);     x = y == z ; printf("%d\n",x);     x == ...
  • Program output 3: Give the output on the screen of the following program #include <stdio.h>int main(){    int x = 3, y = 1 , z = 0;     x = x && y || z; printf("%d\n",x);     printf("%d\n",x || ! y && z);     x = y = 2;     ...
  • Program output 5: Give the output on the screen of the following program #include <stdio.h>int main(){    int x , y ,z;      x = y = z = 1;      x += y += z;      printf("%d\n", x < y ? y : x);      printf("%d\n",x < y ? x++:y++)...
  • Program output 6: Give the output on the screen of the following program #include <stdio.h>void print(int x, int y, int z){     printf("x = %d \t y = %d \t z = %d\n", x ,y ,z);}int main(){     int x , y ,z;      x = y = z = 1;     ++x || ++y &...
  • Program output 12: Give the output on the screen of the following program (indicate a space using this symbol _): #include<stdio.h>int main(){     int a = 7, b = 4, c;     double x = 0.02, y = -0.05, z = 0.1 ;     printf("#1# %d ##\n", (a + b) % 1234); ...
  • Program output 13: Give the output on the screen of the following program (indicate a space using this symbol _): #include<stdio.h>double mystery(int T[], int i){     int k;      for(k=0 ; k<i ; k++)          T[k] -= T[i] - k;     return T[k] + ...
  • Program output 4: Give the output on the screen of the following program #include <stdio.h>#define PRINT(i) printf("value = %d\n", i)int main(){     int x = 03, y = 02 , z = 01;     PRINT(x | y & z);      PRINT(x | y & - z);      PRINT(x ^ y ...
  • Program output 7: Give the output on the screen of the following program #include <stdio.h> #define PRINT(format,x) printf(#x " = %"#format"\n",x) int main(){     int integer = 5;     char character = '5';     char *string = "5";     PRINT(d, string)...
  • Program output 8: Give the output on the screen of the following program #include <stdio.h> #define PR(x) printf(#x " = %.8g\t",(double)x)#define NL putchar('\n');#define PRINT4(a,b,c,d) PR(a);PR(b);PR(c);PR(d);NL int main(){     double d;     float f;  Â...
  • Program output 9: Give the output on the screen of the following program #include <stdio.h> #define PR(x) printf(#x " = %.8g\t",(double)x)#define NL putchar('\n');#define PRINT1(a) PR(a);NL#define PRINT2(a,b) PR(a);PR(b);NL int main(){     double d = 3.2 , x;...
  • Program output 10: Give the output on the screen of the following program #include <stdio.h> #define PRINT(format,x) printf(#x " = %"#format"\t",x)#define NL putchar('\n'); #define PRINT1(f,x) PRINT(f,x);NL#define PRINT2(f,x1,x2) PRINT(f,x1);PRINT1(f,x2)#define...
  • Program output 11: Give the output on the screen of the following program #include <stdio.h> #define PRINT(format,x) printf(#x " = %"#format"\t",x)#define NL putchar('\n'); #define PRINT1(f,x) PRINT(f,x);NL#define PRINT2(f,x1,x2) PRINT(f,x1);PRINT1(f,x2)#define...

Back to the list of exercises