Soha Farhin Pine - 7 months ago 35

C Question

I need to make a program which is capable of inputing numbers containing upto 100 digits. Which variable type will be suitable for holding such a large number? Should I make a string 101 long?

**The question** *(on which I am working)* **link** -> http://cpbook.subeen.com/2012/11/even-odd-2.html

The question is in Bengali. Therefore, most of the people here won't understand the question. For your ease, I've prepared an English Translation of the question -

Even-Odd-2

A whole number will be given, and you have to make a program that will

determine whether it's an even or odd number.

Input Specification

In the first line, there will be an integer T denoting the number of

testcases. In the following T lines, a non-negative integer will be

given.The number can have maximum 100 digits.

Output Specification

For every whole number given, you will have to print whether it's odd

or even as output.

The sample I/O I guess you can read and understand.

Can anyone guide me on how to solve the problem?

Answer

The program will input a number and determine whether its odd or even

Read the input in a string (`char [101])`

and analyze only last digit to check whether number is odd or even. Rest of the digits are irrelevant for this task.

Source (Stackoverflow)