#include <stdio.h>#include <stdlib.h>#include <conio.h> /* main program fucntion */void main(){ int iMatrSize, // size of the matrix iSum = 0, // sum of the nessesary elements of the matrix iCnt = 0, // number of the nessesary elements of the matrix **aMatr; // the matrix int i, j; scanf_s("%i", &iMatrSize); /* allocation memory for the array */ aMatr = (int**)malloc(sizeof(int) * iMatrSize); for (i = 0; i < iMatrSize; i++) { aMatr[i] = (int*)malloc(sizeof(int) * iMatrSize); } /* filling in the array */ for (i = 0; i < iMatrSize; i++) for (j = 0; j < iMatrSize; j++) aMatr[i][j] = rand() % 21 - 10; /* counting the sum of the elements */ for (i = 0; i < iMatrSize; i++) for (j = 0; j < iMatrSize - i - 1; j++) iSum += aMatr[i][j], iCnt++; /* outputing the array */ for (i = 0; i < iMatrSize; i++) { for (j = 0; j < iMatrSize; j++) printf ("%3i ", aMatr[i][j]); printf("\n"); } printf("Sum = %f\n", (float)iSum / iCnt); _getch();} /* End of 'main' function */
Const e=0.001; var x,xn,h,an,s,f,y:real; n,k,i:integer; begin n:=10; h:=(1-0.1)/(n-1); x:=0.1-h; for i:=1 to n do begin x:=x+h; an:=1; xn:=1; f:=1; k:=0; s:=1; while an>e do begin xn:=xn*x*x; k:=k+1; f:=f*k; an:=(2*k+1)*xn/f; s:=s+an; end; y:=(1+2*x*x)*exp(x*x); writeln('x = ',x:4:1,' s = ',s:6:4,' y = ',y:6:4); end; end.
Результат: x = 0.1 s = 1.0303 y = 1.0303 x = 0.2 s = 1.1241 y = 1.1241 x = 0.3 s = 1.2911 y = 1.2911 x = 0.4 s = 1.5490 y = 1.5490 x = 0.5 s = 1.9260 y = 1.9260 x = 0.6 s = 2.4653 y = 2.4653 x = 0.7 s = 3.2320 y = 3.2320 x = 0.8 s = 4.3240 y = 4.3240 x = 0.9 s = 5.8894 y = 5.8895 x = 1.0 s = 8.1548 y = 8.1548
#include <iostream>
using namespace std;
int main() {
cin >>a;
cin >>b;
if (a<b) {
cout <<a;
}
if (b<a) {
cout <<b;
}
return 0;
}