schema
This commit is contained in:
		
							parent
							
								
									0bff677e4f
								
							
						
					
					
						commit
						13a514d406
					
				@ -14,8 +14,7 @@ bool IsValidNumber(const char *line) {
 | 
			
		||||
int main() {
 | 
			
		||||
    char line[MAX_LINE_LENGTH];
 | 
			
		||||
    double result = 0;
 | 
			
		||||
    int exponent = 2; 
 | 
			
		||||
 | 
			
		||||
    int exponent = 2;
 | 
			
		||||
 | 
			
		||||
    if (fgets(line, MAX_LINE_LENGTH, stdin) == NULL || !IsValidNumber(line)) {
 | 
			
		||||
        printf("Nepodarilo sa nacitat zaklad x\n");
 | 
			
		||||
@ -23,7 +22,7 @@ int main() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    double x = strtod(line, NULL);
 | 
			
		||||
    result += x; 
 | 
			
		||||
    result += 1;
 | 
			
		||||
 | 
			
		||||
    while (1) {
 | 
			
		||||
        if (fgets(line, MAX_LINE_LENGTH, stdin) == NULL || !IsValidNumber(line)) {
 | 
			
		||||
@ -35,9 +34,9 @@ int main() {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        x = strtod(line, NULL);
 | 
			
		||||
        result += x * exponent; 
 | 
			
		||||
        result = result * x + 1;
 | 
			
		||||
 | 
			
		||||
        exponent--; 
 | 
			
		||||
        exponent--;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    printf("Vysledok je: %.2f\n", result);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user