Answers for "Add, multiply and rate with a range of numbers"

C
0

Add, multiply and rate with a range of numbers

#include <stdio.h>

int main(void) {
   int i,n,t[n],s,p,r;
    printf("how many number do you want to calculate each sum and product? :");
     scanf("%d",&n);
      for (i=0;i<n;i++){ 
        printf("enter the %d number :",i+1); 
        scanf("%d",&t[i]);
         }
          s=0;
           p=1;
            for (i=0;i<n;i++){
               s= s+t[i];
                p=p*t[i];
                 r=s/n;
                  }
                   printf("The sum of the numbers is : %d\n",s);
                    printf("The result of multiplying numbers : %d\n",p);
                     printf("The rate of this setting is : %d\n",r); 
                     return 0;
                      }
Posted by: Guest on July-11-2021

Code answers related to "Add, multiply and rate with a range of numbers"

Code answers related to "C"

Browse Popular Code Answers by Language