Output:
print function is used to create unformatted output
it can be called with or without parentheses
For example:
print “This is Sample”;
print(“This is Sample”);
print “The Result is: $sum”;
print (“The Result is: $sum”);
printf function is used to create formatted output. For example
printf(“string”, para1, para2… paran)
The string can contain text to be displayed and format codes. The format code contains percentage sign (%) with field width and type specifier.
%s Strings
%d integers
%f double or float
The field with is either integer or two integers separated by a decimal for double and float.