Running Your First Programs in C

One of my duties at National University of Engineering is to teach C to first year students.  I have talk about paradigms of programming and some history regarded to C language, starting with the year of creation 1969 – 1973 at AT&T Bell Labs and highlighting that the Linux kernel was written in C because of its power that let manage resources of the computer.

My first hello world!

hello.c

Then, to compile the program we run the command gcc, to finally execute ithello

Working with numbers and operations

  1. Checking if the number is even or oddeven

The output for 3 and 8:odd

2. Check if a number is divisible by 9div9

The output for 27 and 50:test_div9

3. Determine the largest of three numberslargest

The output for integers and decimal numbers:test_largest

4. Enter three numbers and sort them in decreasing ordersorting

The output for the three numbers are:5. Having an angle in degrees, determine to which quadrant belongsquadrant

the output for the 190 degrees is:test_quadrant

6. Determine if a year higher than 1600, is a leaf-year or notleaf

The output for years higher than 1600 and less than ittest_leaf

7. Calculating the amount to pay the telephone billbill

the output for the basic plan and additional minutes and megabytes:bill_test

Advertisements

About Julita Inca

Ingeniero de Sistemas UNAC, Magíster en Ciencias de la Computación PUCP, OPW GNOME 2011, Miembro de la GNOME Foundation desde el 2012, Embajadora Fedora Perú desde el 2012, ganadora del scholarship of the Linux Foundation 2012, experiencia como Admin Linux en GMD y Especialista IT en IBM, con certificaciones RHCE, RHCSA, AIX 6.1, AIX 7 Administrator e ITILv3. Experiencia académica en universidades como PUCP, USIL y UNI. HPC researcher, a simple mortal, like you!
This entry was posted in τεχνολογια :: Technology and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s