Output of the Given C Program
What is the output of the given program? #include int main() { int a = 5; a = 6; int b = -1; b = -4; int c; c= (a+b); printf("%d",c); return 0; }
Answers
Answered by
3
output will not come since you had assigned two values for same alphabet.
try like this
#include<stdio.h>
void main()
{ int a=5,b=6,c=-1,d=-4,k;
k=a+b+c+d;
printf("%d",k);
}
try like this
#include<stdio.h>
void main()
{ int a=5,b=6,c=-1,d=-4,k;
k=a+b+c+d;
printf("%d",k);
}
Answered by
0
2, if the user remove the syntax error which is in the place "#include".
Explanation:
- The above code is written in the c language, which has one syntax error for the header file, where the user needs to mention the header file.
- Then the code will give 2 as the result because when any variable has defined some value and when the other statement changes the value of that variable then the new value will be modified.
- Hence for the statement "int c=(a+b)", the a and b value will be 6 and -4.
- Hence c will hold the 2.
Learn More ;
- C-Program : https://brainly.in/question/3999878
Similar questions