Chu So Tang Giam

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

// 5.cpp : chu so tang/gi?

m
//
#include "stdafx.h"
#include<stdio.h>
#include<conio.h>
void main()
{
int n,t=0;
printf("nhap n:");
scanf_s ("%d",&n);
int c,d=n;
while(d!=0)
{
t++;
d=d/10;
};
printf("so co %d chu so \n",t);
c = n%10;
int z = n/10,x,y;
d = z%10;
if ( d < c)
{
x = z%10;
z = z /10;
y = z%10;
while ( y < x )
{
x = z%10;
z = z /10;
y = z%10;
if (z == 0)
{
printf ("chu so tang dan ");
return;
}
}
printf ("lon xon cmnr \n ");
}
if ( c < d)
{
x = z%10;
z = z /10;
y = z%10;
while ( y > x )
{
x = z%10;
z = z /10;
y = z%10;
if (z == 0)
{
printf ("chu so giam dan \n");
return;
}
}
printf ("lon xon cmnr \n ");
return;
}

printf ("khong on gioi \n ");


getch();
}

You might also like