Find the number of permutations x1, x2, x3, x4, x5 of numbers 1, 2, 3, 4, 5 such that the sum of five products x1x2x3 + x2x3x4 + x3x4x5 + x4x5x1 + x5x1x2 is divisible by 3
Answers
Answer:
좋은아침이에요저를 따라 오십시오.
jeoleul ttala osibsio.
안녕하세요
Answer:
C program for possible permutations.
Question :Find the number of permutations x1, x2, x3, x4, x5 of numbers 1, 2, 3, 4, 5 such that the sum of five products x1x2x3 + x2x3x4 + x3x4x5 + x4x5x1 + x5x1x2 is divisible by 3
Step-by-step explanation:
From the above question,
They have given :
The number of permutations x1, x2, x3, x4, x5 of numbers 1, 2, 3, 4, 5 such that the sum of five products x1x2x3 + x2x3x4 + x3x4x5 + x4x5x1 + x5x1x2 is divisible by 3.
Here is the program to find the permudation :
C PROGRAM :
#include <stdio.h>
void swap(char *x, char *y)
{
char temp;
temp = *x;
*x = *y;
*y = temp;
}
void permute(char *a, int l, int r)
{
int i;
if (l == r)
printf("%s\n", a);
else
{
for (i = l; i <= r; i++)
{
swap((a+l), (a+i));
permute(a, l+1, r);
swap((a+l), (a+i));
}
}
}
int main()
{
char str[] = "ABC";
int n = strlen(str);
permute(str, 0, n-1);
return 0;
}
For more such related questions : https://brainly.in/question/5828822
#SPJ2