Merge branch 'master' of git.kemt.fei.tuke.sk:oh735kh/pvjc21
Merge request
This commit is contained in:
commit
0cd5b2c0e5
@ -1,14 +1,17 @@
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
int main (){
|
||||
char c[100];
|
||||
char musor;
|
||||
int counter = 0;
|
||||
fgets(c, 100, stdin);
|
||||
musor = getchar();
|
||||
while(fgets(c, 100, stdin) != NULL){
|
||||
if(strlen(c) == 2){
|
||||
if(strlen(c) == 1){
|
||||
putchar (c[0]);
|
||||
counter++;
|
||||
}
|
||||
else if(strlen(c) == 2){
|
||||
if (c[0] >= 'a' && c[0] <= 'z'){
|
||||
putchar (c[0] - 'a' + 'A');
|
||||
printf ("\n");
|
||||
@ -23,21 +26,24 @@ int main (){
|
||||
putchar (c[0]);
|
||||
counter++;
|
||||
}
|
||||
fgets(c, 100, stdin);
|
||||
musor = getchar();
|
||||
}
|
||||
else{
|
||||
for(int i = 0; i < 100; i++){
|
||||
if(c[i] == '\n') break;
|
||||
if(isupper(c[i]))
|
||||
printf(tolower(c[i]));
|
||||
if(c[i] == '\n' || c[i] == '\0') break;
|
||||
if(isupper(c[i])) {
|
||||
printf("%c", tolower(c[i]));
|
||||
}
|
||||
else if(islower(c[i]))
|
||||
printf(toupper(c[i]));
|
||||
printf("%c", toupper(c[i]));
|
||||
else
|
||||
printf(c[i]);
|
||||
printf("%c", c[i]);
|
||||
}
|
||||
if(strchr(c, '\n') != NULL){
|
||||
printf("\n");
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
//counter++;
|
||||
memset(c, '\0', 100);
|
||||
}
|
||||
|
||||
printf("\nPočet riadkov: %d\n",counter);
|
||||
|
||||
30
program.c
Normal file
30
program.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
int main () {
|
||||
char* BMW = (char*) calloc (100, sizeof(char));
|
||||
int x;
|
||||
int counter;
|
||||
int numbers [100];
|
||||
for (int i = 0; fgets(BMW, 100, stdin) != NULL; i++){
|
||||
if (!strcmp("\n", BMW) || !strcmp(" ", BMW)) {
|
||||
counter = i;
|
||||
break;
|
||||
}
|
||||
if (i == 0){
|
||||
x = atoi (BMW);
|
||||
}
|
||||
else {
|
||||
numbers [i] = atoi [BMW];
|
||||
}
|
||||
}
|
||||
int result = 0;
|
||||
while (counter > 0){
|
||||
result += pow (x, counter -1) * numbers [counter];
|
||||
counter --;
|
||||
}
|
||||
printf ("Vysledok je: ");
|
||||
printf ("%d\n", result);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user