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 ___ _________ ____ ______ ___ ______.
__________ __________ _____ _________ _______ ________ __________ _____ ___ ____ __________.
___ ___ ________ _____ _____ _________ ______ __________.
_____ ___ ____ ___ _______ ____ ___ ______.
__________ ____ _______ ______ _________ __________ _____ ______ ___ ____ ____.
_________ _____ ___ __________ _______ ______.
______ _____ _____ ________ _________ ________ _______ _____ _________.
________ ___ __________ ______ __________ _______.
________ _______ _________ ____ __________.
________ _____ _____ ____ ___ ________ ___ ____.
________ _________ ____ _________ _________.
_______ ______ ______ _____ _________ ________ __________ _____ ________ ________ _________ __________.
_______ ________ _______ ______ ___.
_____ ____ _________ ______ _________ ______ _____ __________.
____ ____ _______ _________ _______ __________ ______ _____.
_____ __________ ____ ________ ___ ________.
_____ _________ __________ _______ _________ __________ _________ __________ __________ __________.
__________ _______ ______ ______ ______ _____ ___.
_____ ________ ___ ____ _________.
___ _________ ___ ___ _______ _______ ________ ______ _____.
____ ____ ___ ________ ____ ________ _______ ___ __________ ________ ______.
___ ___ __________ ____ ______ _____ _______ __________.
___ __________ ___ _______ _____ ________ ___.
_______ ____ _______ __________ _____ __________ ________ ________ ________ _______ _________.
______ __________ __________ _________ ________ _____ _________ ______.
________ _________ _____ ________ ___ _______ ______ _____ ________ __________.
____ ___ ____ __________ ______ ___ _________ _____ ________.
____ __________ _________ _________ ______.
_________ __________ ______ __________ ___.
______ ______ ____ ____ ___.
_____ ______ ___ _____ ____ __________ ______ ___ _____ _____.
__________ ________ ____ ________ ______ ____.
____ ____ _______ __________ _________ ______ _____ _________ ______.
_____ ___ _________ ________ ____ __________ _____ ___ ____ __________.
____ __________ ___ __________ _____ __________ __________.
__________ _____ _________ __________ ______ ______ ____ _____.
_____ __________ _______ ______ ______ ______ ______ _________.
_________ __________ _____ ____ _____ __________.
______ ________ ___ _________ ____ ________.
__________ ___ _______ ________ _______ ______ ______.
_______ _________ ______ ____ _______ ____.
__________ _________ ____ ___ ______ __________ _________ ______.
_________ _______ ___ _____ _____ ______.
_____ ________ _________ ____ _________ _______.
______ ______ _____ __________ _____ _______ ___ _______ ____ _____.
__________ __________ _____ _______ ____ ___.
________ ________ ______ ____ __________ _________.
___ ________ _______ ____ _______ _______ _____ _________ ____ ______.
__________ ________ ________ ____ _______.
_______ _________ ___ _______ _____.
_____ _____ ____ ___ _____ _____.
____ ______ __________ ____ ____ _______ ______ ________ _____ ____ __________ _______.
______ _____ _____ ___ ___ ________ _____ ________ _________ ____ __________ _____.
_________ ____ ______ _______ ________ ____.
________ ___ ______ _________ ________ _____ _____ _________ ____ ______ _________.
__________ ______ ____ _________ ____ ______ __________ _______.
_____ ______ _______ _______ _________ ______ _________ _______ _________ ___ ________ _____.
_____ _______ ______ _______ __________.
________ _______ ______ __________ _____ ________ ___ _______ _____ ________ _________ __________.
_________ _________ ________ ____ ___ __________ _____ ______ _____ _____ _________.
________ ________ _____ __________ _____ ________ ______ ____ ___ ______ ______ __________.
________ ___ ______ ___ __________.
____ __________ _______ ________ _________.
___ _____ ___ _____ ______ _____ ______ _________ ___ __________ ________ ________.
_______ _______ _______ _________ _____ _______.
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