Commit f04beed4 authored by Min's avatar Min
Browse files

time to git commited

parent ee7d7ccb
// Programmer: Andy Min
// MST Username:axmt2y
// Instructor: Azharul Islam
// Section: 307
// Date: 02/3/2021
// File: lab3.cpp
// Description:
#include <iostream>
using namespace std;
const int IF_DIGIT_EVEN = 5;
const int IF_DIGIT_ODD = 8;
int main()
{
/*DECLERATIONS*/
int number;
int remainder;
int middle_number;
/*GREETING AND INPUT */
cout<<"Enter your input integer:"<<endl;
cin>>number;
/*COMPUTATIONS AND OUTPUT*/
while (number != 0)
{
remainder = (number % 10);
if ((remainder % 2) != 0)
{
remainder -= IF_DIGIT_ODD;
if (remainder < 0)
{
middle_number = (remainder * remainder);
remainder = middle_number / 10;
cout<<remainder<<endl;
}
else
{
cout<<remainder<<endl;
}
}
else
{
remainder += IF_DIGIT_EVEN;
if (remainder >= 10)
{
remainder = remainder % 10;
cout<<remainder<<endl;
}
else
{
cout<<remainder<<endl;
}
}
number = (number / 10);
}
}
File added
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment