Solution For C Program -
Showing posts with label Element. Show all posts
Showing posts with label Element. Show all posts
C program to Given a vector (integer or real), determine what is the maximum value of element what is the position in which this element is located
How to write a C program to Given a vector (integer or real), determine what is the maximum value of element what is the position in which this element is located ?
Soution For C Program:
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);
}
Napisać funkcję obliczającą funkcję geometryczną w tablicy NxM elementowej z elementów o wartościach parzystych znajdujących się pod główną i ponad przeciwną przekątną.
Napisać funkcję obliczającą funkcję geometryczną w tablicy NxM elementowej z elementów o wartościach parzystych znajdujących się pod główną i ponad przeciwną przekątną.
Write a function that calculates the geometric function in an array NxM elements from the elements with values even located under the main and over the opposite diagonal .
Solution For C Program :
// Napisać funkcję obliczającą funkcję geometryczną w tablicy NxM elementowej z elementów o wartościach parzystych znajdujących się pod główną i ponad przeciwną przekątną.
float average (int tab[N][M])
{
int i,j,iloczyn=1;
for(i=0;i<N;i++)
for(j=0;j<M;j++)
if(i>j && i<(N-1)-j && i&1==0)
iloczyn*=tab[i][j];
return pow(iloczyn, (1/(N*M)));
}
Subscribe to:
Posts (Atom)