float readTempCelsius(float x) {
printf("Introduceti temperatura in grade Celsius: ");
scanf("%f", &x);
return x;
}
float celsius2fahrenheit(float y) {
float z = 1.8 * y + 32;
return z;
}
int main() {
float n;
n = readTempCelsius(n);
printf("%f grade Celsius = %f grade Fahrenheit.\n", n , celsius2fahrenheit(n));
return 0;
}
//2//
#include <stdio.h>
int determinant(int m[3][3]) {
int i, j, det, s1, s2;
printf ("Introduceti elementele matricei: ");
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
scanf("%d", &m[i][j]);
}
}
s1 = m[0][0] * m[1][1] * m[2][2] + m[1][0] * m[2][1] * m[0][2] + m[0][1] * m[1][2] * m[2][0];
s2 = m[2][0] * m[1][1] * m[0][2] + m[0][0] * m[2][1] * m[1][2] + m[2][2] * m[1][0] * m[0][1];
det = s1 - s2;
return det;
}
int main() {
int mat[3][3];
int det = determinant(mat);
printf("Determinantul matricei date este %d.\n", det);
return 0;
}
// 3//
#include <stdio.h>
int f(int m[100][100], int line, int column, int c) {
int i, j, s = 0;
printf("Introduceti numarul de linii: ");
scanf("%d", &line);
printf("Introduceti numarul de coloane: ");
scanf("%d", &column);
printf ("Introduceti elementele matricei: ");
for (i = 0; i < line; i++) {
for (j = 0; j < column; j++) {
scanf("%d", &m[i][j]);
}
}
printf("Introduceti numarul coloanei: ");
scanf("%d", &c);
if (c < 0 || c >= column) {
printf("Numarul coloanei introdus este invalid!\n");
return s;
}else {
for (i = 0; i < line; i++) {
s = s + m[i][c];
}
}
return s;
}
int main() {
int s, m[100][100], line, column, c;
s = f (m, line, column, c);
printf("%d\n", s);
return 0;
}
//4 //
#include <stdio.h>
#include <string.h>
void palindrom(char sir[100]) {
int i, s = 0;
printf("Introduceti cuvantul: ");
for (i = 0; i < 100; i++) {
scanf ("%c", &sir[i]);
if(sir[i] == 10) {
sir[i] = '\0';
break;
}
}
int len = strlen(sir);
for (i = 0; i < len; i++) {
if (sir[i] == sir[len - 1 - i]) {
s++;
}
}
if (s == len) {
printf("Cuvantul este palindrom!\n");
}else {
printf("Cuvantul nu este palindrom!\n");
}
return;
}
int main() {
char sir[100];
palindrom(sir);
return 0;
}
// 5 //
#include <stdio.h>
#include <string.h>
int f(char sir1[100], char sir2[100]) {
printf("Introduceti primul sir: ");
scanf("%s", sir1);
printf("Introduceti al doilea sir: ");
scanf("%s", sir2);
int len1 = strlen(sir1);
int len2 = strlen(sir2);
int x;
if (len1 > len2) {
x = 1;
}else if (len1 < len2) {
x = -1;
}else {
x = 0;
}
return x;
}
int main() {
char sir1[100], sir2[100];
int x;
x = f(sir1, sir2);
printf("%d\n", x);
return 0;
}
//6//
#include <stdio.h>
void sortare(int sort, int v[100]) {
int i, numar_elemente;
printf("Introduceti numarul de elemente din vector: ");
scanf("%d", &numar_elemente);
printf("Introduceti elementele vectorului: ");
for(i = 0; i < numar_elemente; i++) {
scanf("%d", &v[i]);
}
printf("Introduceti valoarea lui sort: ");
scanf("%d", &sort);
Please edit your post and make sure your code is [code]between code tags[/code] so that it has line numbers and syntax highlighting, as well as proper indentation.
You forgot to ask a question, so I have no idea what you want.