Computer Science, asked by ddiya29891, 29 days ago

write a program to calculate the sum of the numbers occuring in the multiplication table of 8 in c ​

Answers

Answered by BrainlyProgrammer
6

Answer:

#include <stdio.h>

int main() {

for (int j=0; j <= 10; j++) {

printf("%d x %d = %d\n", 8, j, 8*j);

}

return 0;

}

Logic:-

  • Run a loop from 1 to 10
  • multiply 8 with the loop value
  • print the product.

Required Output:-

8×0=0

8×1=8

8×2=16

8×3=24

8×4=32

8×5=40

8×6=48

8×7=56

8×8=64

8×9=72

8×10=80

Answered by karunaKetan
1

Answer:

# include<stdio.h>

# include<conio.h>

void main(){

 int i,n=8,sum=0;

 

 for(i=1 ; i<=10 ; i++){

   printf("%d * %d = %d \n \n",n,i,n*i);

 }

 sum=sum+n*i;

 printf("Sum = %d \n",sum);

 getch();

}

Explanation:

Here i acts as a looping variable and n acts as a number whose multiplication table is to be found.

Here, at first i printed the multiplication table of 8 and then calculated the sum of the table.

Output:

8 * 1 = 8

8 * 2 = 16

8 * 3 = 24

8 * 4 = 32

8 * 5 = 40

8 * 6 = 48

8 * 7 = 56

8 * 8 = 64

8 * 9 = 72

8 * 10 = 80

Sum = 88

Similar questions