Hello Guys!!! How are you, all? Hope, you all are well by the grace of Almighty ALLAH. Today we learn how to sum from 1 to any number.
generally we know that,
summation of n numbers = n x (n+1) / 2 .
Now, we can write a C programming code by using this formula. Let's look at the program:
In this code, if the input is 100, then output will be:
Output: Enter the value of n: 100
Sum: 5050
Thank you all..:)
generally we know that,
summation of n numbers = n x (n+1) / 2 .
Now, we can write a C programming code by using this formula. Let's look at the program:
In this code, if the input is 100, then output will be:
Output: Enter the value of n: 100
Sum: 5050
Thank you all..:)
0 comments:
Post a Comment