# Introduction

Through the program we do computations on data, which may be of various types depending on the requirements of the application. For ordinary arithmetic we need integers, for real life applications there are real numbers, called float, e.g., Rs. 30.5/kg onion, and the names are represented as character strings, and individual characters are are char types. The following example demonstrates this.

The above programs gives many things to learn:

• the main() is a function, and the program in this are run first, always, in any C program. This function is run by the OS (operating system). When it is successfully run, it returns a code value to OS, e.g., 0 will be returned if it has successfully run, and other values, say -1 if there is some error of running it. So, the OS will come to know what has happened through that code. That is why there is “int" before main, to indicate that main returns an integer value.

• Following to main there are always data declaration. That is, the names of data and their values if available. The values of these data may be available by assigning to these names (of data), or may be input from keyboard while the program runs, or these data may also come from other places, e.g., files, or network or internet.

• Various data declared in this program are wt, which can be integer only, rate and total, which are float, e.g., 240.5, 20.124, etc. The third data is s, which is character, and its length is 20. So it is an array of 20 characters. None of the data is initialized in the program, and they will be assigned by input, while total will be assigned by calculation by multiplication operation.

• The printf is a function. It as text string as one argument embedded with image of data items shown by %d, %f, %c, etc, with floating length or %5d, %0.2f, %s with specified length. These formats are for integer, real, character strings. The string in the printf is followed with data arguments or variable names. The format of printf we call as syntax of print statement.

• The scanf is a function with two argument types: 1) data formats, like, %d, %f, %c, etc put under the quotes, and this is followed with memory locations where values shall be stored of the given data items or variables. This we call as syntax of scanf statement. If a variable is wt, then its memory location is &wt, similarly for rate variable it is &rate, etc. However, for the data which is array, e.g., character array, the start memory location where it is stored is the name of the array itself. For example, for “char s[10]", the start location of its memory is s, or &s[0]. Both are equal and have same meaning.

• You need to describe a C program code with comments inside the program itself. There are two types of comments:
1. Multiple line comment: Embed the comment between /* and */
2. Single line comment: // this is in single line