Component Communication in React: Complete Beginner's Guide (2026)

Image
  What is Component Communication in React? Introduction Component Communication is the process of sharing data, functions, and events between React components so they can work together, respond to user interactions, and keep the application's user interface updated. When you build a React application, you don't create everything inside a single file. Instead, you divide the application into small, reusable components. Each component has its own responsibility. For example, one component may display a navigation menu, another may show a list of products, while another handles the shopping cart or a login form. Although these components are independent, they still need to work together. A product component must inform the shopping cart when a user adds an item. A search box must send the entered keyword to the product list so it can display matching results. A login form must notify the main application after a successful login. The process that allows these components to excha...

PHP program using sum of digits

Q. Sum of Digits in php 



 Example :-

<?php
$number =1222;
$sum=0;
$rem=0;
for($i=0;$i<=strlen($number);$i++)
{
    $rem = $number% 10;
    $sum = $sum + $rem;
    $num = $number/10;
}
echo " number is $number = Addition of digits
<br> Answer is $sum";


?>


Sum of Digits in php 

Output:-

sum of digits php program



Q. Sum of digit using form  php

Example :-

<form method="post">
    Enter number
    <input type="number" name="number"><br><br>
    <input type="submit" value="submit">
</form>
<?php
if( $_POST)
{


$number =$_POST['number'];
$sum=0;
$rem=0;
for($i=0; $i<=strlen($number); $i++)
{
    $rem = $number% 10;
    $sum = $sum + $rem;
    $number = $number/10;
}
echo " number is $number Addition of digits
<br> Answer is $sum";
}

?>


Sum of digit using form  php 

Output :-
sum of digits php program

Related Articles:-

php program to print alphabet pattern O

php array

Type of css

Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

HTML Input Type Submit Syntax and Example