#include #define NUM 100 //since prog is to be written for adding 100 naturalint main(){int i,sum=0;for(i=1;i
#include#include#includevoid main(){int i,n,sum=0;clrscr();printf("n=");scanf("%d",&n);for (i=1;i
to print the sum of first ten numbers:- void main() {int i,sum; sum=0; while(i<=10) sum=sum+i; i=i+1; } printf("The sum is : %d",sum); }
#include#includevoid main(){int sum_sqr(int n);clrscr();printf("%d",sum_sqr(5));//Sum of first 5 natural numbers' square valuesgetch();}int sum_sqr(int n){int i,sum=0;for(i=1;i
int sum = 0; int i; for(i = 0; i < n; ++i) { sum += i; }
#include #define NUM 100 //since prog is to be written for adding 100 naturalint main(){int i,sum=0;for(i=1;i
Sum = 0 For N = 1 to 10 Sum = Sum + 2*N Next N Print Sum
main() { int i, n, sum=0; cout<<"Enter the limit"; cin>>n; for(i=0;i<=n;i++) sum=sum+i; cout<<"sum of "<<n<<" natural numbers ="<<sum; getch(); }
Print "Type the upper limit (n) ?" Input n K = -1 WHILE K < = n K = K + 2 Sum = Sum + K WEND Print "The sum of all odd numbers up to "; n; "is "; Sum
SUM = 0: FOR N = 1 to 100: SUM = SUM + N: Next N: PRINT CHR$(11); "Sum ="; SUM: END
step 1 : n = 11, sum = 0 step 2 : then sum = sum + n2 step 3 : n = n + 2 step 4 : if n > 50, go to step 6 step 5 : loop to step 2 step 6 : print sum step 7 : end
#include#include#includevoid main(){int i,n,sum=0;clrscr();printf("n=");scanf("%d",&n);for (i=1;i
For N = 2 to 30 STEP 2 Sum = Sum + N Next N Print "The sum is "; Sum; ". Have a nice day. Come back and see us." END
Mean = (sum of the n numbers)/n
1 Sum of first n natural numbers = n(n+1)2[Formula.]2 Arthmetic mean of first n natural numbers = Sum of the numbers n[Formula.]3 = n(n+1)2n = n+124 So, the Arthmetic mean of first n natural numbers = n+12
Formula for sum of first natural number = n(n+1)/2 , here n=225 so, answer is 225(225+1)/2 = 25425
Yes.Since 1 is a member of the Fibonacci sequence, it is always possible. Any natural number, N, can be represented as a sum of a string of N ones.Yes.Since 1 is a member of the Fibonacci sequence, it is always possible. Any natural number, N, can be represented as a sum of a string of N ones.Yes.Since 1 is a member of the Fibonacci sequence, it is always possible. Any natural number, N, can be represented as a sum of a string of N ones.Yes.Since 1 is a member of the Fibonacci sequence, it is always possible. Any natural number, N, can be represented as a sum of a string of N ones.