serhatitap adlı üyeden alıntı: mesajı görüntüle
/******************************************************************************

Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>
#include <locale.h>
#include <conio.h>
#include <math.h>
#include <float.h>


int main(void) {
setlocale(LC_ALL,"Turkish");

int tweety=18.80;
int bugsbunny=17.80;
int spiderman=19.20;
int kacmetrekare=0;
float hesap=0;

char tip;
printf("Siparişiniz aldığınız halı tipini girin: \n");
scanf("%c", &tip);

printf("Döşenecek halının metrekaresi: \n");
scanf("%d", &kacmetrekare);




if(tip=='t' || tip=='T'){
hesap=kacmetrekare*tweety;
printf("\nToplam tutar : %f", hesap);
}

else if(tip=='b' || tip=='B'){
hesap=kacmetrekare*bugsbunny;
printf("\nToplam tutar : %f", hesap);
}

else if(tip=='s' || tip=='S'){
hesap=kacmetrekare*spiderman;
printf("\nToplam tutar : %f", hesap);
}
else{
printf("Lütfen geçerli bir tip giriniz.");
}


return 0;
}
Çıktısı
Siparişiniz aldığınız halı tipini girin:                                                                                      
s
Döşenecek halının metrekaresi:
4

Toplam tutar : 76.000000

...Program finished with exit code 0
Press ENTER to exit console.
Kod doğru fakat int değişkenlerde noktalı değer alamaz bu sebeple yanlış hesaplıyor. Float yaparsanız program düzelir ellerinize sağlık.