12-20-2015, 10:11 AM
Kod:
#include <stdio.h>
int yaz(int sy)
{
if (sy < 10){
switch (sy)
{
case 1: printf("Bir"); break;
case 2: printf("Iki"); break;
case 3: printf("Uc"); break;
case 4: printf("Dort"); break;
case 5: printf("Bes"); break;
case 6: printf("Alti"); break;
case 7: printf("Yedi"); break;
case 8: printf("Sekiz"); break;
case 9: printf("Dokuz"); break;
}
}
if (sy >= 10 && sy < 100)
{
switch ((sy - (sy % 10)) / 10)
{
case 1: printf("On"); yaz(sy % 10); break;
case 2: printf("Yirmi"); yaz(sy % 10); break;
case 3: printf("Otuz"); yaz(sy % 10); break;
case 4: printf("Kirk"); yaz(sy % 10); break;
case 5: printf("Elli"); yaz(sy % 10); break;
case 6: printf("Altmis"); yaz(sy % 10); break;
case 7: printf("Yetmis"); yaz(sy % 10); break;
case 8: printf("Seksen"); yaz(sy % 10); break;
case 9: printf("Doksan"); yaz(sy % 10); break;
}
}
}
main()
{
int sayi, sayi2;
basla:
printf("1 ile 999 arasi bir sayi giriniz: ");
scanf("%d", &sayi);
printf("n");
if (sayi < 1 || sayi > 999){printf("n"); goto basla;
}else{
if (sayi < 10){
switch (sayi)
{
case 1: printf("Bir"); break;
case 2: printf("Iki"); break;
case 3: printf("Uc"); break;
case 4: printf("Dort"); break;
case 5: printf("Bes"); break;
case 6: printf("Alti"); break;
case 7: printf("Yedi"); break;
case 8: printf("Sekiz"); break;
case 9: printf("Dokuz"); break;
}
printf("n");
}
if (sayi >= 10 && sayi < 100)
{
switch ((sayi - (sayi % 10)) / 10)
{
case 1: printf("On"); yaz(sayi % 10); break;
case 2: printf("Yirmi"); yaz(sayi % 10); break;
case 3: printf("Otuz"); yaz(sayi % 10); break;
case 4: printf("Kirk"); yaz(sayi % 10); break;
case 5: printf("Elli"); yaz(sayi % 10); break;
case 6: printf("Altmis"); yaz(sayi % 10); break;
case 7: printf("Yetmis"); yaz(sayi % 10); break;
case 8: printf("Seksen"); yaz(sayi % 10); break;
case 9: printf("Doksan"); yaz(sayi % 10); break;
}
printf("n");
}
if (sayi >=100 && sayi < 1000)
{
sayi2 = ((sayi - (sayi % 100)) / 100);
if (sayi2 > 1) {yaz(sayi2);}
printf("Yuz");
yaz(sayi % 100);
}
printf("n");
goto basla;
}
}
#include <stdio.h>
int yaz(int sy)
{
if (sy < 10){
switch (sy)
{
case 1: printf("Bir"); break;
case 2: printf("Iki"); break;
case 3: printf("Uc"); break;
case 4: printf("Dort"); break;
case 5: printf("Bes"); break;
case 6: printf("Alti"); break;
case 7: printf("Yedi"); break;
case 8: printf("Sekiz"); break;
case 9: printf("Dokuz"); break;
}
}
if (sy >= 10 && sy < 100)
{
switch ((sy - (sy % 10)) / 10)
{
case 1: printf("On"); yaz(sy % 10); break;
case 2: printf("Yirmi"); yaz(sy % 10); break;
case 3: printf("Otuz"); yaz(sy % 10); break;
case 4: printf("Kirk"); yaz(sy % 10); break;
case 5: printf("Elli"); yaz(sy % 10); break;
case 6: printf("Altmis"); yaz(sy % 10); break;
case 7: printf("Yetmis"); yaz(sy % 10); break;
case 8: printf("Seksen"); yaz(sy % 10); break;
case 9: printf("Doksan"); yaz(sy % 10); break;
}
}
}
main()
{
int sayi, sayi2;
basla:
printf("1 ile 999 arasi bir sayi giriniz: ");
scanf("%d", &sayi);
printf("n");
if (sayi < 1 || sayi > 999){printf("n"); goto basla;
}else{
if (sayi < 10){
switch (sayi)
{
case 1: printf("Bir"); break;
case 2: printf("Iki"); break;
case 3: printf("Uc"); break;
case 4: printf("Dort"); break;
case 5: printf("Bes"); break;
case 6: printf("Alti"); break;
case 7: printf("Yedi"); break;
case 8: printf("Sekiz"); break;
case 9: printf("Dokuz"); break;
}
printf("n");
}
if (sayi >= 10 && sayi < 100)
{
switch ((sayi - (sayi % 10)) / 10)
{
case 1: printf("On"); yaz(sayi % 10); break;
case 2: printf("Yirmi"); yaz(sayi % 10); break;
case 3: printf("Otuz"); yaz(sayi % 10); break;
case 4: printf("Kirk"); yaz(sayi % 10); break;
case 5: printf("Elli"); yaz(sayi % 10); break;
case 6: printf("Altmis"); yaz(sayi % 10); break;
case 7: printf("Yetmis"); yaz(sayi % 10); break;
case 8: printf("Seksen"); yaz(sayi % 10); break;
case 9: printf("Doksan"); yaz(sayi % 10); break;
}
printf("n");
}
if (sayi >=100 && sayi < 1000)
{
sayi2 = ((sayi - (sayi % 100)) / 100);
if (sayi2 > 1) {yaz(sayi2);}
printf("Yuz");
yaz(sayi % 100);
}
printf("n");
goto basla;
}
}