Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ---------------- 1 ----------------
- #include <stdio.h>
- #include <math.h>
- int main() {
- double a, x, y;
- for (a = 4; a < 6.1; a += 0.2) {
- for (x = 3; x <= 5; x += 0.5) {
- if (x != a) {
- y = sqrt(x * x + a * a) / (x - a);
- printf("\ta = %lf, x = %lf\n\ty = %lf\n", a, x, y);
- }
- }
- }
- }
- // ---------------- 2 ----------------
- #include <stdio.h>
- #include <math.h>
- int main() {
- double e, x, c, result = 0;
- unsigned n = 1;
- scanf("%lf%lf", &x, &e);
- c = e;
- for(short digit = 1; c >= e; digit *= -1, ++n) {
- c = digit * pow(x, 2 * n - 1) / (4 * n * n - 1);
- result += c;
- }
- printf("%lf", result);
- }
- // ---------------- 3 ----------------
- #include <stdio.h>
- int main() {
- FILE* input = fopen("input.txt", "r");
- unsigned a, b;
- fscanf(input, "%u%u", &a, &b);
- int matrix[a][b];
- for (unsigned i = 0; i < a; ++i) {
- for (unsigned j = 0; j < b; ++j) {
- fscanf(input, "%i", &matrix[i][j]);
- }
- }
- fclose(input);
- FILE* output = fopen("output.txt", "w");
- for (unsigned i = 0; i < a; ++i) {
- for (unsigned j = 0; j < b; ++j) {
- fprintf(output, "%4i ", matrix[j][i]);
- }
- fprintf(output, "\n");
- }
- fclose(output);
- }
- // ---------------- 4 ----------------
- #include <stdio.h>
- #include <string.h>
- int main() {
- char sentence[BUFSIZ];
- gets(sentence);
- FILE* output = freopen("output.txt", "w", stdout);
- char separators[] = " ,.";
- char* word = strtok(sentence, separators);
- while (word != NULL) {
- if (strlen(word) % 2 != 0) {
- printf("%s ", word);
- }
- word = strtok(NULL, separators);
- }
- fclose(output);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement