Note: At First, Solve this Programme Without Using Computer. Then run it in your Computer to Check your Answer.
a) What is the output of the following program?
#include <stdio.h>
int main() {
int x;
char y;
x = 100;
y = 'D';
x += 5;
y --;
printf("%c %d",x, y);
return 0;
}
 
b) What is the output of the following program?
#include <stdio.h>
 int main() {
 int a, b, c;
 a = 10;
 b = 5;
 c = 3;
 a = a / b ;
 b = c * a;
 c = b % c;
 a = a + b;
 c = b * a - c; 
printf("%d %d %d\n",a,b,c);
 
return 0;
 }
c) What is the output of
     the following program for the inputs below?                                                       
    i)  100 15 10           ii) 50 -10 5
    iii) -10 -10 -10       iv) 11 5 8
    v) 5 1 100              vi) 4 200 3
    vii) 1 2 3               viii) 12 550 -40
 
#include <stdio.h>
 int main()
 {
    int a, b, c;
    scanf("%d%d%d",&a,&b,&c);
    if( a == 5 || b > 10 && c <= 15)
               printf("A");
    else if( a >= 2 && b < 6 || c >= 13)
               printf("B");
    else if( a == 5 && b <= 8 && b == 5)
              printf("C");
    if( a <= 5 || b > -10 || a <= 15)
             printf("D");
    else if( a >= 0)
             printf("E");
     if( c%4 > 2 || b == 10 && c > 5)
             printf("F");
     if( a%3 < 1 && b > 144 && c <= 7)
             printf("G");
     else
            printf("H");
            printf("\n");
 
return 0;
}
 
 
download file in here
ReplyDelete