Click here to Skip to main content
15,076,130 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C++
#include<stdio.h>
{
 int a=10,b=15,c=20;
 c=a+b;
 prinf("%d\n",c);
}


What I have tried:

I Want this answer as soon as possible.
Posted
Updated 14-Aug-18 7:51am
v2
Comments
Dave Kreskowiak 14-Aug-18 9:48am
   
You can demand the answer all you want. We're not going to do your homework for you.

This wont compile, because basic rules arent met, as written before.

Dig through the tutorial Learn C++ to learn the basic of coding.
   
Run it and see.
But I'll give you a clue: it's a compiler error, along the lines of "expected identifier or '(' before '{' token"

Your C program needs a main function in order to work - so the compiler knows where to start executing. Without that, you don't have an app at all, and it won't run or output anything.
Plus ... printf requires a 't' to be recognised.
Other than that, what do you think it should output? What would you expect if I asked you to add 10 and 15 and tell me what total you got?

C++
#include <stdio.h>

int main()
{
    int a=10,b=15,c=20;
    c=a+b;
    printf("%d\n",c);
    return 0;
}
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900