c++ da 4 basamaklı bir sayıyının basamak değerini bulan program.
#include <stdlib.h>
#include "stdafx.h"
#include <conio.h>
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int X, Y, Z, T , sayi;
cout << "4 Basamakli bir sayi girin: ";
cin >> sayi;
while (sayi<1000 || sayi>10000);
{
X = sayi / 1000;
Y = (sayi % 1000) / 100;
Z = (sayi % 100) / 10;
T = sayi % 10;
cout << endl << "Birler: " << T << endl;
cout << endl << "Onlar: " << Z << endl;
cout << endl << "yuzler: " << Y << endl;
cout << endl << "Binler: " << X << endl;
}
system("pause");
return 0;
}
0 Yorum:
Yorum Gönder
Kaydol: Kayıt Yorumları [Atom]
<< Ana Sayfa