31: W.A.P. to find the summation of 1 to 10 digits.

 

31: W.A.P. to find the summation of 1 to 10 digits.

Program:

#include <stdio.h>

#include <conio.h>

 

void main()

{

                clrscr();

    int sum = 0;

 

    for (int i = 1; i <= 10; i++)

    {

        sum = sum + i;

    }

    printf("Summation = %d", sum);

 

    getch();

}

  

Please follow me for more practicals....


Output:

Summation = 55

  

Please follow me for more practicals....


Algorithm:

        1.       START

        2.       Declare sum = 0, i = 1;

        3.       Repeat up-to step-5 until i <= 10.

        4.       sum = sum + i.

        5.       i++.

        6.       Display sum.

        7.       STOP

  

Please follow me for more practicals....


Flowchat:

 

Please follow me for more practicals....




Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.