Thursday, December 5, 2013

C Programming.....How many integers you want to add.....

C PROGRAMMING/Enter number integers to add




#include <stdio.h>
#include <stdlib.h>






int main()
{
    int a,b,c,sum;

   printf("ENTER number of integers you wanna add\n");
   scanf("%d",&a);


   printf("Enter numbers\n");
   scanf("%d",&b);
   int array2[b];

sum=0;
   for (c=0;c<a;c++){

       sum=sum+array2[b];
   }
   printf("Sum is %d\n", sum);

}/>

1 comment:

  1. Compile and Run....Haven't checked yet but looking should work.....Code Blocks is an excellent source to write/compile/run any c program...Code Blocks may come as free software with limitations..But still good with limitations...

    ReplyDelete