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)));
}
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 Returns the nth element of the Fibonacci sequence.
How to write a C Program To Returns the nth element of the Fibonacci sequence in C Programming Language ?
Solution For C Program :
/*C Program To Returns the nth element of the Fibonacci sequence.*/
#include <stdio.h>
/**
* Returns the nth element of the Fibonacci sequence.
*/
int fibRecursive(unsigned int n)
{
// There is no 0th element of the Fibonacci sequence.
if (n == 0) return -1;
// Base case: 1st or 2nd elements.
if (n == 1 || n == 2) return 1;
// Otherwise, return the sum of the (n-1)th and (n-2)th elements.
return fibRecursive(n - 1) + fibRecursive(n - 2);
}
int main()
{
printf("The fibonacci sequence is:\n");
for (unsigned int n = 1; n < 20; ++n) {
printf("%d\n", fibRecursive(n));
}
printf("...\n");
return 0;
}
Subscribe to:
Posts (Atom)