Showing posts with label Product. Show all posts
Showing posts with label Product. Show all posts

Write the procedure , which is one of a sum , a product and a geometric average in the panel for the NxM elements are located on opposite diagonal and main diagonal . Remind ! Counting only odd elements !

Write the procedure , which is one of a sum , a product and a geometric average in the panel for the NxM elements are located on opposite diagonal and main diagonal . Remind ! Counting only odd elements !


Schreib die Prozedur, die zählt eine Summe, einen Produkt und einen geometrischen Durchschnitt in der Tafel NxM fur die Elemente befinden sich über gegenläufigen Diagonale und unter hauptsächlichen Diagonale. Erinner! Zähl nur für ungerade Elementen!


Solution For C Program :

//Schreib die Prozedur, die zählt eine Summe, einen Produkt und einen geometrischen Durchschnitt in der Tafel NxM fur die Elemente befinden sich über gegenläufigen Diagonale und unter hauptsächlichen Diagonale. Erinner! Zähl nur für ungerade Elementen!

void prozedur (int tafel[N][M])
{
int i=0,j=0,Summe=0,Produkt=1;
float Durchschnitt;
for(i;i<N;i++)
   for(j;j<M;j++)
      if(i>j && i<(N-1)-j && tafel[i][j]!=0)
         Summe+=tafel[i][j];
         Produkt*=tafel[i][j];
Durchschnitt=Summe/(N*M);
printf("Summe ergibt: %d Produkt ergibt: %d geometrischer Durchschnitt ergibt: %d,Summe,Produkt,Durchschnitt);
}

C Program Array NxM Elements Geometric/Arithmetic

How to Write a C Program for numbering the product of all real numbers listed in the array NxM elements,  or function counting the arithmetic average of all the numbers listed in the array NxM Elemental, for counting the geometric mean NxM array elements and for counting the arithmetic average above the main diagonal in the table NxM elements in C Programming Language ?


//Napisać procedurę liczącą iloczyn wszystkich liczb rzeczywistych znajdujących się w tablicy NxM elementowej.

Write procedure for numbering the product of all real numbers listed in the array NxM elements.



void iloczyn (int tablica[N][M])
{
 int i,j,iloczyn=0;
for(i=0;i<N;i++)
    for(j=0;j<M;j++)
       iloczyn*=tablica[i][j];
printf("Iloczyn liczb w tablicy wynosi: ",iloczyn);
}

//Napisać procedurę lub funkcję liczącą średnią arytmetyczną wszystkich liczb znajdujących się w tablicy NxM elementowej.

Write a procedure or function counting the arithmetic average of all the numbers listed in the array NxM Elemental



float srednia_aryt(int tablica[N][M])
{
int i,j,suma=0;
for(i=0;i<N;i++)
    for(j=0;j<M;j++)
       suma+=tablica[i][j];
return suma/N*M;
}

 //Napisać procedurę liczącą średnią geometryczną w tablicy NxM elementowej.

//Write procedure for counting the geometric mean NxM array elements.



float srednia_geo(int tablica[N][M])
{
int i,j,iloczyn=0;
for(i=0;i<N;i++)
    for(j=0;j<M;j++)
       iloczyn*=tablica[i][j];
return pow(iloczyn,NxM);
}

   //Napisać procedurę liczącą średnią arytmetyczną ponad główną przekątna w tablicy NxM elementowej.

Write procedure for counting the arithmetic average above the main diagonal in the table NxM elements.



float srednia_aryt(int tablica[N][M])
{
int i,j,suma=0;
for(i=0;i<N;i++)
    for(j=0;j<M;j++)
       if(i<j)
         suma+=tablica[i][j];
return suma/N*M;
}

C Program To Find Product Of Two No Using MACRO

How to write a C Program To Find Product Of Two No Using MACRO in C Programming Language ?


Solution For C Program :

/*C Program To Find Product Of Two No Using MACRO.*/

#include<stdio.h>
#include<conio.h>
#define prod(t,r) t*r
void main()
{
int a,b,c;
printf("enter two no. for finding product\n");
scanf("%d%d",&a,&b);
c=prod(a,b);
printf("%d",c);
getch();
}

You may also learn these C Program/Code :

C Program To Swap Two Numbers Without Using Third Variable

C Program to Find The Product Of Two Numbers Without Multiplication Operator.

How to write a C Program to find the product of two numbers without Multiplication Operator in C Programming Language ?

Solution for C Program: 

/*C Program to Find The Product Of Two Numbers Without Multiplication Operator.*/
#include<stdio.h>
void main()
{
int x, y, I, sum;
printf("\nEnter any two numbers : ");
scanf("%d%d", &x, &y);
I = 1;
sum = 0;
while(I <= y)
{
sum += x;
I++;
}
printf("\nThe Product of %d and %d is %d.", x, y, sum);
}

You may also learn these C Program/Code :

C Program To Swap Two Numbers Without Using Third Variable

Menu Driven Program to Read Two Integers Find Sum, Difference and Product C Program

How to write C Program a menu driven program to read two integers and find their sum, difference & product in C Programming Language ?



Solution:
/* Write a menu driven program to read two integers & find their sum, difference & product. */

#include<stdio.h>

int main()
{

signed int a[2];
signed int sum,diff,prod;
printf("Enter the two numbers to find sum,difference,product \n");
scanf("%d%d",&a[0],&a[1]);
int option='s';

printf("Enter the character \n 1 -> to find sum \n 2 -> to find difference \n 3 -> to find the product \n ");
scanf("%d",&option);

switch(option)

case 1: {
sum=a[0]+a[1];
printf("the sum of the two numbers is %d \n",sum);
  //break;
}

case 2: {
diff=a[0]-a[1];
printf("the sum of the two numbers is %d \n",diff);
//break;
}

case 3: {
prod=a[0]*a[1];
printf("the sum of the two numbers is %d \n",prod);
//break;
}

default: printf("you have entered the wrong character");

return 0;
}