# Solve Me First Hackerrank Problem coderinme

##### Solve Me First

The purpose of this challenge is to familiarize you with reading input from stdin (the standard input stream) and writing output to stdout (the standard output stream) using our environment.

Review the code provided in the editor below, then complete the solveMeFirst function so that it returns the sum of two integers read from stdin. Take some time to understand this code so you’re prepared to write it yourself in future challenges.

Select a language below, and start coding!

Input Format

Code that reads input from stdin is provided for you in the editor. There are lines of input, and each line contains a single integer.

Output Format

Code that prints the sum calculated and returned by solveMeFirst is provided for you in the editor.

```#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int solveMeFirst(int a, int b) {
return a+b;
}
int main() {
int num1,num2;
scanf("%d %d",&num1,&num2);
int sum;
sum = solveMeFirst(num1,num2);
printf("%d",sum);
return 0;
}
```

###### When a program starts, three text streams are defined:

Standard input (stdin) reads input from the terminal
Standard output (stdout) writes output to the terminal
Standard error (stderr) writes diagnostic output to the terminal.
Streams stdin, stdout, and stderr are implicitly opened the first time they are used.

Stream stdin is opened with fopen(“stdin”, “r”).
Stream stdout is opened with fopen(“stdout”, “w”).
Stream stderr is opened with fopen(“stderr”, “w”).
These streams are not real iSeries Data Management system files, but are simulated as files by the ILE C library routines. By default, they are directed to the terminal session.

The stdin, stdout, and stderr streams can be associated with other devices using the OS/400 override commands on the files STDIN, STDOUT, and STDERR respectively. If stdin, stdout, and stderr are used, and a file override is present on any of these streams prior to opening the stream, then the override takes effect, and the I/O operation may not go to the terminal.

If stdout or stderr are used in a non-interactive job, and if there are no file overrides for the stream, then the ILE C compiler overrides the stream to the printer file QPRINT. Output prints or spools for printing instead of displaying at your workstation.

If stdin is specified (or the default accepted) for an input file that is not part of an interactive job, then the QINLINE file is used. You cannot re-read a file with QINLINE specified, because the database reader will treat it as an unnamed file, and therefore it cannot be read twice. You can avoid this by issuing an override. If you are reading characters from stdin, F4 triggers the run time to end any pending input and to set the EOF indicator on. F3 is the same as calling exit() from your ILE C program.

If stdin is specified in batch and has no overrides associated with it, then QINLINE will be used. If stdin has overrides associated with it, then the override is used instead of QINLINE.

### hasectic

A web developer(Front end and Back end), and DBA at csdamu.com. Currently working as Salesforce Developer @ Tech Matrix IT Consulting Private Limited. Check me @about.me/s.saifi