Use programming c Create a script that will add all integers

Use programming c Create a script that will add all integers between 1 (initial) and 100 (final). Create another script that will do the same operation, but this time use decrement operator so can have 100 for initial integer and 1 for the final integer

Solution

a)

#inlcude<stdio.h>

void main()

{

int n,sum=0;

for (n=1;n<101;n++)

{

sum=sum+n;

}

printf(\"sum is %d\", &sum);

}

b)

#inlcude<stdio.h>

void main()

{

int n,sum=0;

for (n=100;n>0;n--)

{

sum=sum+n;

}

printf(\"sum is %d\", &sum);

}

 Use programming c Create a script that will add all integers between 1 (initial) and 100 (final). Create another script that will do the same operation, but th

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site