Skip to main content

Output for the program "10"+20+30

Output for the program "10"+20+30


If we add a string literal before any other datatype such as integer or float etc then the compiler will treat all other datatypes as a string and the output that will be printed is 
102030

output for the program "10"+20+30

The compiler will simply concatenate the string and will print the output.

But on the other side, If we add the integer values before and the string literal later on then the compiler will add both of the integer values and concatenate the string literal. In this case, the output that will be printed by the compiler is 5010.
output for the program "10"+20+30



Comments

Popular posts from this blog

C++ Program Finding The Absolute Value

#include<iostream> using namespace std; int main() { cout<<" enter any number"; cin>>num; if(num>0) { cout<<"The absolute value of number is:"<< num; } else { cout<<"The absolute value of number is :"<< -(num); } return 0; } OUTPUT Enter Any number: 2 The absolute value of number is 2

Threat wandering on Amazon Rainforest

Threat wandering on Amazon Rain forest Amazon Rain forest is the world's largest rain forest in the world and situated in Brazil and extended to Columbia Peru and other South American countries , famed for its biodiversity. Its crisscrossed by thousands of rivers,including the powerful Amazon. The area in which the Amazon Rain forest is spread is about 5.5 million square km. Amazon rain forest is said to be the lungs of the planet earth which produces about 20% of the earth total oxygen that is consumed on the planet earth.  Since last few days there is huge threat wandering on lungs of the planet IE the Amazon rain forest. The forest is covered with the intense and huge fire and burning continuously from days. Fire is so huge that it can turn the rain forest into the Savannah in few more days which will be the huge loss to the planet earth as it will not able to fulfill the amount of required oxygen by the people residing on it. The city of Roraim...