Skip to content
Snippets Groups Projects
Commit 4ee933c8 authored by Florian Burgener's avatar Florian Burgener
Browse files

Ex 1

parent 28de996c
Branches
No related tags found
No related merge requests found
......@@ -15,30 +15,27 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main() {
// int32_t values_length = 5;
// double values[values_length];
char str1[100];
char str2[100];
// for (int32_t i = 0; i < values_length; i += 1) {
// double value;
// scanf("%lf", &value);
// values[i] = value;
// }
scanf("%s", str1);
scanf("%s", str2);
// int32_t values_length = 5;
// int32_t values[values_length];
if (strlen(str1) != strlen(str2)) {
printf("\ndistance: -1\n");
return EXIT_FAILURE;
}
// for (int32_t i = 0; i < values_length; i += 1) {
// int32_t value;
// scanf("%d", &value);
// values[i] = value;
// }
int32_t distance = 0;
// char a[100];
// int32_t b;
// scanf("%s %d", a, &b);
// printf("%s %d\n", a, b);
for (int32_t i = 0; i < (int32_t)strlen(str1); i += 1) {
distance += abs(toupper(str1[i]) - toupper(str2[i]));
}
printf("\ndistance: %d\n", distance);
return EXIT_SUCCESS;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment