1. Write a program to generate a vector of size n entered from the keyboard, with random integers in the interval: k - w, then form two new vectors, the first one with primes ordered in increasing form and the other with ordered non-prime numbers in a decreasing way.
28. For any n generate
Example for n = 5:
9 8 7 6 5
16 15 14 13 4
21 20 19 12 3
24 23 18 11 2
25 22 17 10 1
79. Generate a matrix of size NF * NC, with random integers between zero and one hundred, then separate the perfect ones first, then the non-perfect ones, by columns from bottom to top and from left to right.
92. Generate a matrix of size n, with random numbers, then add a new column and a new row, in these new spaces, obtain the number of primes per rows, the number of non-primes per columns and the number of perfects in the main diagonal
Example for n = 5:
6 16 20 23 25 1
70 12 17 21 24 1
4 8 13 18 22 1
2 51 97 28 19 4
1 3 11 10 15 2
4 3 1 4 4 2
What I have tried:
#include <iostream>
using namespace std;
void listaMatriz(int m[][50], int n){
int f,c;
cout << endl << "listado " << endl;
for(f=0;f<n;f++){
for(c="0;c<n;c++){
cout << "\t" << m[f][c];
}
endl;
}
}
void efila(int m[][50], int f, int n, int *e){
int c, et=*e;
for (c=0; c < n-(f+1); c++){
m[f][c]=et;
et++;
*e=et;
}
void ecolumna(int fi;
c=n-(f+1);
(fi=f; fi < n; fi++){
m[fi][c]=et;
escuadras(int m[][50], n){
f,e=1;
(f=0; f< n; f++){
efila(m,f,n,&e);
ecolumna(m,f,n,&e);
}
}
int main(int argc, char *argv[]) {
m[50][50];
n="10;
escuadras(m,n);
listamatriz(m,n);
return="" 0;
}