Question

Write the output of the following C codes, with proper justification for each. 
i) main()
{
int a = 2, b = 4, c = 5;
a = b + c;
b = a + c;
c = a - b;
printf("%d,%d,%d", a, b, c);
}
ii) main()
{
printf("%d", ‘C’ + ‘P’ + ‘r’ + ‘o’ + ‘g’ + ‘r’ + ‘a’ + ‘m’);
}
iii) main()
{
int i, j = 1;
for(i = 1; i <= 10; i = i + 2)
{
j = i - j;
while(j <= 2)
printf("%d ", i+j++);
}
}
iv) main()
{
int a = 10, b = 20, c = 30;
int *p = 2;
a = c/*p;
b = c;
printf("a = %d, b = %d", a, b);
}
v) func(int x)
{
static int a = 0;
a += x;
return(a);
}
main()
{
int p;
for(p = 1; p <= 5; ++p)
printf("%d", fun(p));
}

26 Feb 2024
Answer :
Word Count : 640

i) 

main() {
    int a = 2, b = 4, c = 5;
    a = b + c;   // a = 4 + 5 = 9
    b = a + c;   // b = 9 + 5 = 14
    c = a - b;   // c = 9 - 14 = -5
    printf("%d,%d,%d", a, b, c);  // Output: 9,14,-5
}

Explanation: 
- Initially, `a` is assigned 2, `b` is assigned 4, and `c` is assigned 5.
- Then, `a` is updated to the sum of `b` and `c`, `b` is updated to the sum of the updated `a` and `c`, and `c` is updated to the difference between the updated `a` and `b`.
- Finally, the values of `a`, `b`, and `c` are printed.

ii) 

main() {
  _________ __________ _____ ________ ___ _________ _________ ______ ____.
______ ____ _____ _____ _____ _______ _____ ________ _____ ____ ________.
_________ _______ ___ _______ _________ ________ _______ _______.
___ ________ _______ _______ ________.
____ ____ _________ ___ ________ _________ ________ ______ ________ ______.
___ _______ _____ ____ ______ ____ _______ ______ __________ __________.
______ _________ ____ _____ ________ _____ __________ _______.
________ _____ ___ __________ ______ _____ _____ __________ _______ ____.
___ ______ __________ _________ ____ _____ ________ ____ ___.
___ __________ _____ _________ _______ __________ __________ __________ ______ _________ _________ _____.
_________ _____ __________ ______ ________.
_________ __________ ________ _____ _________ ____ ___ _______.
__________ __________ _______ ______ _____ __________ ______ ______.
____ _____ ______ _______ ___ _______ _________.
__________ _______ _____ ________ _______ ______ ________ __________ ______ _____ ___.
______ _______ __________ _______ _____ ______ ___ _____.
____ ____ ____ _______ ___ ____ _____ ________ _________ ________ __________.
_________ ______ _________ ______ _____.
________ ____ ___ __________ __________ _____ __________ _____ _______ _______ __________ ______.
___ __________ _____ ____ _______.
__________ ________ _________ ________ _______.
_________ ___ _____ ________ _______.
______ _________ __________ _________ __________ ____ _________ ______ _______ ________ ____.
______ ___ _______ ______ ____ _________ ____ _________ ______.
________ _____ ___ _________ _________ _______ ________ ____.
___ ______ _______ ___ ______.
____ _______ ________ _________ _________ _____ ______ ______ ______ __________ ___.
______ _______ ________ __________ _____ _________ ___ __________ ___ ____ ______ ___.
_____ ____ _______ ___ __________ ______ ____ ___ __________ _________ ___ _____.
_________ _____ _____ ________ ________ ______ ___ ____ _____ _________.
____ ___ _________ _______ ___ ________ ____ _______.
_____ ______ _______ _______ _____ ___.
_________ ____ ____ ______ ________ __________ ____ ______ _____ _________ _________.
_________ _________ _____ _________ ______.
__________ __________ ____ ________ ________ _________ ________ _______ ____.
________ _________ ________ ____ _____ _________.
______ ____ ______ __________ _____ _________ ________ _________ __________ ________.
__________ ___ _________ ___ ___ _________ ________ ________ ____.
_________ _____ _____ ________ ______ _____ ___ _________ _____ ____.
____ __________ ________ ___ _____.
___ __________ ____ __________ ____ ____ ____ ____ _____ _________ ______ ___.
__________ _______ ________ ___ _________ _____ ____ _________ _______ ________ ______ _______.
________ __________ ____ ____ __________ _______.
________ _________ _____ _______ ___ _____ _____ ______ __________ ___ _______ ___.
________ _________ _____ _____ ____ _____ ___ ______ _________.
______ ____ _____ _______ ___ _______ ___ ___ _________ ___.
___ ____ __________ ______ __________ ____.
_____ _____ __________ ___ ______ __________ _______ ______ ____ __________.
_______ _________ ____ ______ ____ _____ _____ __________ ______ ________ _______ _______.
_____ ________ ________ ______ __________ _______ ________ ______ ___ ______ _____ ___.
_______ ____ ____ ________ _________ _________ _________ ________ _____ ______.
____ ___ ________ _____ _______ ______ ________ __________ __________ ____ ______.
__________ _______ _________ _________ _________ __________ _______ _______ _______ __________ _________ ________.
_______ ____ ________ _____ ___ __________ ______.
Get Full Answer on WhatsApp

IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★
Top
📞
Call Support Instant phone assistance Write the output of the following C codes, with proper justification f
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→