The below program is written in C , I think it's very easy for you guys to convert it into classic ASP.
Program to take input from the user and print a new number by adding one to each of its digits.
Program to take input from the user and print a new number by adding one to each of its digits.
void main()
{
//Variable declaration
int Count = 0;
int NoOfdigits = 1;
int InputNumber;
int incri= 1;
int FinalResult= 0;
int i;
//Taking input from the user
printf("Enter the Number less
than 10 digit ::");
scanf("%i",&InputNumber);
NoOfdigits = InputNumber;
//Calculating
the length on input number
while(NoOfdigits > 0)
{
NoOfdigits = NoOfdigits/10;
Count = Count++;
}
//adding one in each digit of the
input number
for(i = 0 ; i < Count;i++)
{
FinalResult += ((InputNumber%10) +1)*incri;
incri = incri*10;
InputNumber = InputNumber/10;
}
printf("\n%d Final result after
adding one in each digit ::",FinalResult);
getch();
program to find out whether a input number is an odd number or even number.
int
inputNumber;
printf("Enter the number
:\t");
scanf("%d",&inputNumber);
if(inputNumber >= 0)
{
if(inputNumber%2 == 0)
{
printf("Number is
Even");
}
else
{
printf("Number is
Odd");
}
}
else
{
printf("Invalid
Entry");
}
No comments:
Post a Comment