Lab 4 - FL13 - ECE 198 JL - University of Illinois - Engineering Wiki

For ex ample y ou have different k inds of integer

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ata ty pes . For ex ample y ou have different k inds of integer data ty pes , eac h having different properties but having one c ommon link that they are all integers . Inte ge r data type s unsigne d int - Lik e the name s ugges ts , c an hold only pos itive numbers . Can hold a higher value than normal int as the s ame number of bits are us ed to repres ent only pos itive numbers now. long - On the lab mac hines , this a 64-bit value with a muc h bigger range when c ompared to the s imple int data ty pe. unsigne d long - On the lab mac hines , 64-bit uns igned integer. short - 16-bit integer refer to C Programming Referenc e for the c omplete lis t Float data type double - provides more prec is ion than the s imple float data ty pe. Up to 10 dec imal plac es of prec is ion. Numerical computations Before s tarting to work on this part, mak e s ure to update y our loc al s vn c opy . You s hould have a new direc tory , c alled lab4 in y our ec e198jl direc tory . In this direc tory y ou s hould find files lab4.tx t and lab4.c whic h y ou will need to modify per ins truc tions provided below and to c ommit the c hanges to s vn. W rite a program to c arry out the following c omputations and ans wer the ques tions below 1. -22 * 33 2. 12 / 3 3. 10 / 3 The "*" operator in C multiplies two numbers . The "/" operator divides two numbers . Carry out eac h of the above mentioned c omputations by s toring the firs t and the s ec ond values as the following data ty pes : 1. 2. 3. 4. i nt unsigne d int floa t doubl e As a s tarting point, y ou c an us e the following program whic h c omputes firs t ex pres s ion us ing int ty pes for the arguments and the res ult. #nld <ti.> icue sdoh itmi( n an) { itvl =-2 n a1 2; itvl =3; n a2 3 itrs n e; rs=vl *vl; e a1 a2 pit(%\" rs; rnf"dn, e) } rtr 0 eun ; Als o c arry out the following c omputations us ing int as the data ty pe to hold the numbers . 1. 12 % 3 2. -11 % 3 Als o pay attention to the "printf" func tion, the s pec ifier lik e "% d&qu...
View Full Document

This document was uploaded on 03/22/2014.

Ask a homework question - tutors are online