/* * Compile commandline: cc -std=gnu99 -Wall -Wextra -Os -o tva tva.c * Source code: https://04d.co/dl/software/tva.c * License: public domain */ #include float tva(float x, float y) { return x * y; } int main(void) { float inVal, valEUR; printf("TVA calculator v0.1\n\n"); printf("EUR value: "); if(scanf("%f", &valEUR) != 1) { printf("Input is not int or float\n"); return 1; } do { printf("TVA> "); if(scanf("%f", &inVal) != 1) { printf("Input is not int or float\n"); return 1; } printf("TVA A (19%%): %.2f RON\n", tva(inVal, 0.19)); printf("TVA B (9%%): %.2f RON\n", tva(inVal, 0.09)); printf("TVA C (5%%): %.2f RON\n", tva(inVal, 0.05)); printf("Converted: %.2f EUR\n\n", inVal / valEUR); } while(1); }