Bir önceki örneğimizde if-else yapısını kullanarak basit bir hesap makinesi oluşturmuştuk. Şimdi de aynısını Switch-case yapısını kullanarak oluşturacağız. Switch-case yapısının detaylı anlatımı için C Dili Switch-case sayfasını ziyaret edebilirsiniz.
#include <stdio.h>
main()
{
int sayi1,sayi2;
int islem;
printf("1.Sayiyi giriniz:");
scanf("%d",&sayi1);
printf("2.Sayiyi giriniz: ");
scanf("%d",&sayi2);
printf("\n\n1.Toplama\n");
printf("2.Cikarma\n");
printf("3.Bolme\n");
printf("4.Carma\n");
printf("\nIslemi seciniz:");
scanf("%d",&islem);
switch(islem){
case 1:
printf("Toplama isleminin sonucu : %d",sayi1 + sayi2);
break;
case 2:
printf("Cıkarma isleminin sonucu : %d",sayi1 - sayi2);
break;
case 3:
printf("Bolme isleminin sonucu : %f", (float) sayi1 / (float) sayi2);
break;
case 4:
printf("Carpma isleminin sonucu : %d", sayi1 * sayi2);
break;
default:
printf("Lutfen gecerli bir sayi giriniz..");
}
}
Yukarıdaki kod da öncelikle kullanıcıdan 2 tane sayı alıyoruz. Daha sonra kullanıcıya yapmak istediği işlemi soruyoruz ve kullanıcının seçimine göre ilgili işlemi yapıp ekrana yazdırıyoruz.
Kodun ekran çıktısı da şu şekildedir:

140 Yorum
olmuyor abii
Nerede hata alıyorsun
Sürekli default da yazan şey karşıma çıkıyor hesaplama yapamadım maalesef.
Yazdığın kodu iletir misin ?
nerden iletebilirim hocam?
#include
#include
int main(){
int sayi1,sayi2,islem;
printf(“ilk Sayiyi Girin”);
scanf(“%d”,&sayi1);
printf(“ikinci sayiyi girin”);
scanf(“%d”,&sayi2);
printf(“\n\n1.toplama\n”);
printf(“2.cikarma\n”);
printf(“3.carpma\n”);
printf(“4.bolme\n”);
printf(“Hangi islemi yapmak istiyorsunuz?”);
scanf(“%d”,islem);
switch(islem) {
case 1:
printf(“toplama isleminin sonucu : %d”,sayi1+sayi2);
break;
case 2:
printf(“cikarma isleminin sonucu : %d”,sayi1-sayi2);
break;
case 3:
printf(“carpma isleminin sonucu : %d”,sayi1*sayi2);
break;
case 4:
printf(“bolme isleminin sonucu : %f”,(float) sayi1/ (float) sayi2);
break;
}
}
20.satirda ki
scanf(“%d”,&islem) burada ‘&’ isareti kullanmadigin icin islem degiskenini almiyor. İlgili satiri degistirip tekrar dener misin
Hocam teşekkür ediyorum dikkatsizlik dolayı ben mi beceriksizim diyordum. Hallettim şu anda çok güzel çalışıyor elinize sağlık.
Rica ederim, ben de genelde unutuyordum ?
Hocam bu arada bir şey sormak istiyorum. Case 4’de bölme işlemini%d yerine%f ile yani float ile gösteriyoruz bunun nedenini açıklar mısınız?
Sonucun tam cikmasi icin. Ornegin 5/2 yaptigimiz zaman 2.5 sonucunu vermesi icin. int olarak alsaydik 2 sonucunu verecekti.
#include
#include
int main()
{
float n1, n2;
printf(“Enter the first number: “);
scanf(“%f”,&n1);
printf(“enter the second number: “);
scanf(“%f”,&n2);
int op;
printf(“Enter an operator(+,-,/,*,^):”);
scanf(“%d”, &op);
switch (op)
{
case ‘+’:
printf(“%f”,(n1 + n2));
break;
case ‘-‘:
printf(“%f”,(n1 – n2));
break;
case ‘/’:
printf(“%f”,(n1 / n2));
break;
case ‘*’:
printf(“%f”,(n1 * n2));
break;
case ‘^’:
printf(“%f”, pow(n1, n2));
break;
default:
printf(“Error! operator is wrong”);
}
return 0;
}
neden sürekli default yerindeki yazıyı yazdırıyor?
fenofibrate 160mg us tricor 200mg cost fenofibrate 160mg usa
order tadalafil 40mg online viagra online buy viagra generic
zaditor 1mg for sale order ziprasidone tofranil 25mg sale
mintop drug order tamsulosin generic the blue pill ed
pill acarbose 50mg buy glyburide 5mg generic buy griseofulvin 250 mg without prescription
buy aspirin 75mg generic imiquad price buy generic imiquimod
buy meloset 3mg melatonin without prescription danocrine 100 mg sale
buy dipyridamole paypal buy cheap generic gemfibrozil buy pravastatin 10mg for sale
buy dydrogesterone pills dapagliflozin 10 mg usa empagliflozin 10mg ca
buy florinef sale pill imodium loperamide for sale
etodolac cheap cost cilostazol 100mg order generic pletal
order generic prasugrel order generic thorazine 100mg purchase detrol pills
buy generic pyridostigmine over the counter purchase piroxicam generic brand maxalt
buy cheap ferrous sulfate buy risedronate 35mg online buy generic betapace
order zovirax buy generic xeloda order rivastigmine
enalapril 5mg generic duphalac bottless buy duphalac sale
betahistine 16mg price order generic zovirax benemid 500 mg usa
premarin 0.625mg sale order sildenafil 50mg pill viagra australia
buy omeprazole 10mg pill montelukast 10mg generic order lopressor 100mg pill
canadian cialis online pharmacy female viagra pill cheap sildenafil online
buy generic micardis 80mg hydroxychloroquine buy online purchase movfor online cheap
cenforce 50mg uk buy chloroquine online cheap chloroquine 250mg cheap
modafinil 100mg without prescription purchase deltasone buy prednisone 20mg for sale
buy isotretinoin 40mg pills order generic azithromycin 500mg purchase azithromycin
azipro 250mg price neurontin 600mg usa order gabapentin pill
oral lipitor 20mg proventil oral buy amlodipine 10mg online cheap
casino near me lasix 40mg pills lasix drug
poker online for fun buy ventolin 2mg pill order allergy pills
quick hits free online slots best online casino for real money side effects of ivermectin
free slot play slots casino levothroid price
order symmetrel 100 mg atenolol 100mg without prescription dapsone 100 mg brand
clomid over the counter buy isosorbide buy imuran 50mg
Regardless of whether one has thick or thin natural lashes, an extension glue combined with a right-sized extension lashes contributes to a more dramatic look of long black lashes. So what to look for if you want to buy the best lash extension adhesive? Eyelash glue typically comes in two colors: white or black. The white glue is white upon application, so you can see where you’re putting it, but it will dry down to a clear finish. The black is a great choice if you want the eyelash to blend seamlessly into your eyeliner and mascara, but if you’re not careful or ~skilled~, it can get a little messy. Then you have to consider the formula: The classic squeeze bottle or the brush-one adhesion. Typically, the brush glue is better for those who want to be more precise, as well as beginners.
https://eternalbookmarks.com/story15232482/lash-laser
Cons: some users said it left buildup and residue Be sure to check out Vegamour’s Lash & Brow sale today! In other cases, non- natural eyelash serums can even change the colour of your iris! For some reason, the FDA has approved Latisse. This is an eyelash growth serum that does work, but often causes allergic reactions, darkening of the eyelids and iris colour changes due to the presence of its active ingredient, LUMIGAN®.On the other hand, there are plenty of natural alternatives with ingredients that can do wonders for your lashes. And indeed, they’ve been used for millennia! Eyelash serums improve the appearance and length of lashes, but they can also irritate sensitive skin. Steer clear of serums with edible ingredients like coconut and olive oil, as they can grow bacteria that can lead to eye infections and styes. And as with any new product, do a swatch test first to see how your skin will react. Dr. Greenfield suggests applying a very thin layer in the corner of the eyelash to see how your skin responds. If you notice irritation, immediately discontinue use and have your dermatologist give the area a look.
buy generic methylprednisolone for sale buy nifedipine online buy aristocort without a prescription
buy levitra 10mg for sale buy zanaflex online order tizanidine 2mg online
phenytoin 100 mg without prescription order flexeril without prescription purchase oxytrol online cheap
coversum online buy fexofenadine 180mg brand purchase fexofenadine for sale
purchase lioresal without prescription elavil 50mg generic buy toradol online cheap
buy loratadine sale order dapoxetine 30mg online order priligy 30mg generic
baclofen canada order generic ozobax buy ketorolac cheap
buy generic inderal for sale buy motrin 400mg online cheap cost plavix 75mg
purchase amaryl generic buy arcoxia without a prescription order arcoxia without prescription
order nortriptyline 25mg without prescription order generic methotrexate 10mg paracetamol 500mg canada
buy coumadin 5mg generic buy paroxetine pills where to buy maxolon without a prescription
xenical 60mg ca buy xenical 120mg pill buy diltiazem cheap
pepcid 40mg drug famotidine brand buy tacrolimus 1mg pills
azelastine cost zovirax 800mg pill buy irbesartan 150mg pills
order nexium 20mg capsules topiramate pill topamax 200mg without prescription
order generic imitrex buy levofloxacin 500mg generic order avodart
buy allopurinol 100mg for sale allopurinol 100mg cheap oral crestor 10mg
zantac us purchase celebrex without prescription celecoxib 200mg usa
buspar for sale brand ezetimibe 10mg buy amiodarone no prescription
buy flomax generic order tamsulosin 0.2mg without prescription purchase simvastatin pill
domperidone 10mg cost domperidone canada sumycin 250mg sale
buy aldactone 25mg without prescription valacyclovir drug purchase propecia generic
research paper help online pay to do assignment cheap research papers for sale
fluconazole uk generic diflucan order cipro pill
buy generic aurogra for sale buy generic aurogra 100mg buy yasmin without a prescription
order flagyl 200mg generic buy cephalexin cheap cephalexin 500mg generic
lamotrigine 50mg pills minipress 1mg generic brand nemazole
buy generic cleocin online fildena 100mg ca order generic sildenafil 100mg
Dear immortals, I need some wow gold inspiration to create.
buy generic tamoxifen 10mg symbicort brand buy rhinocort sale
order tretinoin without prescription tadalafil 10mg oral buy avanafil 100mg
how to buy axetil cost robaxin 500mg robaxin without prescription
buy tadalafil 10mg pill diclofenac without prescription purchase indomethacin capsule
order desyrel for sale desyrel 100mg usa clindac a cheap
http://withoutprescription.guru/# buy prescription drugs without doctor
oral terbinafine 250mg buy lamisil 250mg online real money casino online
buy aspirin pills safe real money online casinos play blackjack casino games online
write essays online online casinos online money poker
help writing papers for college mba assignment help purchase cefixime generic
https://withoutprescription.guru/# prescription drugs online
https://withoutprescription.guru/# tadalafil without a doctor’s prescription
order calcitriol 0.25mg pill order rocaltrol generic order fenofibrate 200mg sale
https://edpills.icu/# what is the best ed pill
order trimox 250mg pills arimidex 1 mg drug macrobid drug
https://tadalafil.trade/# cost of tadalafil
tadalafil 5 mg tablet coupon tadalafil 2.5 mg online india tadalafil 20mg canada
http://tadalafil.trade/# tadalafil tablets 20 mg buy
80 mg tadalafil tadalafil canadian pharmacy price buy tadalafil cialis
expensive acne medication body acne causes in adults where can i buy oxcarbazepine
http://edpills.monster/# best over the counter ed pills
tadalafil 100mg tadalafil cost india tadalafil 20mg lowest price
best ed pill: ed dysfunction treatment – ed treatment drugs
https://levitra.icu/# Levitra 20 mg for sale
how to buy clonidine order tiotropium bromide without prescription order spiriva without prescription
SmartCredit Ngày 7-7, trên cổng thông tin điện tử, Bộ Công an đã có trả lời các vướng mắc của người dân về việc vay tiền qua app. Không có cách nào cả đâu bạn, nếu đã không chi trả được thì chắc chắn sẽ bị đăng lên mạng xã hội rồi làm phiền bạn ạ. Vì vấn đề này là do bên công ty tài chính kiểm soát chứ mình không thể đưa ra biện pháp nào để giải quyết vấn đề này. Nếu bạn quyết định không trả thì có thể tắt máy, chặn các cuộc gọi từ số lạ, thông báo tới bạn bè người thân về vấn đề đang gặp phải để tránh rắc rối. TTO – Thay vì cho vay bằng tiền mặt thoải mái như hiện nay, tới đây công ty tài chính chỉ được phép cho khách hàng vay tiền mặt tối đa 30% tổng dư nợ, nếu như quy định mới của Ngân hàng Nhà nước được ban hành.
https://www.dday.it/profilo/vaygpthng
Các khách hàng cá nhân vay vốn trung dài hạn phục vụ hoạt động sản xuất kinh doanh, nhu cầu nhà ở đích thực, vay mua ô tô, vay tiêu dùng đảm bảo bằng bất động sản thỏa mãn các điều kiện liên quan của BIDV đều được áp dụng lãi suất ưu đãi trong chương trình này. Vay tín chấp phục vụ mục đích tiêu dùng: dành cho khách hàng có thu nhập từ lương hàng tháng từ 7 triệu trở lên, vay tín chấp theo lương không cần thế chấp tài sản. Hạn mức vay tối đa 500 triệu trong thời gian từ 12 đến tối đa 60 tháng. Lãi suất áp dụng 11,9% năm tính theo dư nợ gốc. Đến hết năm 2022, BIDV dẫn đầu thị trường về tài trợ xanh với hơn 1.386 khách hàng và dự án với tổng số vốn cam kết cấp tín dụng hơn 2,68 tỷ USD. Do đó, việc xây dựng “Khung Khoản vay bền vững” là bước tiếp theo cho phép ngân hàng triển khai giới thiệu các sản phẩm tài chính bền vững với thị trường trong nước.
http://tadalafil.trade/# generic tadalafil 10mg
п»їkamagra buy Kamagra sildenafil oral jelly 100mg kamagra
buy Kamagra Kamagra tablets super kamagra
alfuzosin 10 mg us medications that can cause gerd ibuprofen for stomach ache
doxycycline online Doxycycline 100mg buy online doxycycline 300 mg
zithromax online australia: zithromax z-pak – can you buy zithromax online
purchase minocin generic order requip online buy ropinirole 1mg pills
doxycycline buy usa Buy Doxycycline for acne doxycycline 100 mg cap
doxycycline 1000mg: doxycycline cost united states – doxycycline 20
cost of brand name lisinopril Buy Lisinopril 20 mg online lisinopril pills for sale
doxycycline tablets: buy doxycycline over the counter – doxycycline over the counter nz
7 day sleep prescription buy diet pills online prescription weight loss doctors online
zithromax 250 price buy cheap generic zithromax zithromax order online uk
doxycycline hyc 100mg: doxycycline buy online – doxycycline over the counter australia
canadian pharmacy amoxicillin buy amoxil buy cheap amoxicillin
doxycycline south africa: doxycycline india pharmacy – doxycycline 100 mg india
free medication to quit smoking states that offer free nrt pain medications online to buy
doxycycline online uk: Doxycycline 100mg buy online – buy doxycycline 100mg capsules online
doxycycline hyclate 100 mg cap Doxycycline 100mg buy online buy doxycycline mexico
amoxicillin buy online canada: purchase amoxicillin online – can i buy amoxicillin over the counter
medication from mexico pharmacy: mexican medicine – п»їbest mexican online pharmacies
no prescription drugs canada order medication online cheapest viagra canadian pharmacy
online pharmacies without prescription: online pharmacy no prescription – accutane mexican pharmacy
buy provera 10mg pill microzide usa hydrochlorothiazide for sale
indian pharmacy online: online pharmacy india – best india pharmacy
top 10 mail order pharmacies: legal drugs buy online – fda approved canadian pharmacies
herpes suppressive medication side effects most popular diabetes drugs insulin shots vs pills
canadian prescription costs Top mail order pharmacies canadian pharmacy online without prescription
medicine in mexico pharmacies: mexican pharmacy – mexico drug stores pharmacies
mexican mail order pharmacy: Mail order pharmacy – canadian pharmacy certified
buy cyproheptadine 4 mg without prescription buy nizoral generic order nizoral for sale
buy wellbutrin australia: Buy Wellbutrin XL online – buy generic wellbutrin
supplements that kill candida best rated parafungal capsules high blood pressure tablet name
ventolin 200: Ventolin inhaler online – buy ventolin inhaler
paxlovid pharmacy: Paxlovid buy online – paxlovid buy
paxlovid pill http://paxlovid.club/# paxlovid pill
how to get cymbalta without a prescription duloxetine 40mg us purchase provigil for sale
anticholinergic drugs for ulcer list gram negative bacilli urine treatment gram positive bacilli in urine
wellbutrin canadian pharmacy: Buy bupropion online Europe – 2018 wellbutrin
ventolin inhaler without prescription: buy Ventolin inhaler – can you buy ventolin over the counter in australia