The source code to demonstrate the use of the printf() function is given below. The given program is compiled and executed successfully.
<?php
//PHP program to demonstrate the
//use of printf() function.
$A = 10;
$B = 20;
$C = $A + $B;
printf("Sum is: %d",$C);
?>
Output:
Sum is: 30
Explanation:
In the above program, we created two local variables $A, $B that are initialized with 10 and 20 respectively. Then we assigned the sum of $A and $B to the variable $C, and then printed the sum of $A and $B using printf() function on the webpage.
Program/Source Code:
The source code to demonstrate the use of the printf() function is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we created two local variables $A, $B that are initialized with 10 and 20 respectively. Then we assigned the sum of $A and $B to the variable $C, and then printed the sum of $A and $B using printf() function on the webpage.
need an explanation for this answer? contact us directly to get an explanation for this answer