sheet1 - A in ASCII is d A 3. Write a program that asks the...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Helwan University Faculty of Computers and Information First year CS112 – Programming Language I Academic year (2009/2010) Sheet #1 printf and scanf 1. Identify and correct the errors in each of the following statements ( Note: there may be more than one error per statement): ) a ( “ ” , ); scanf d value ) b (“ % % % ”\ , , ); printf The product of d and d is d n x y ) c (“% ”, ); Scanf d anInteger ) d ( “ % \ ,” + ) printf The sum is d n x y ) e ( “ ); printf The value you entered is d n value 2. What, if anything, prints when each of the following C statements is performed? If nothing prints, then answer “nothing.” Assume x=2 and y=3 . ) a (“% ”, ); printf d x ) b (“% ”, + ); printf d x x ) c (“ =”); printf x ) d (“ =% ”, ); printf x d x ) e (“% = % ”, + , + ); printf d d x y y x ) f = + ; z x y ) g (“% % ”, & , & ); scanf d d x y ) h /* (“ + = % ”, + ); */ printf x y d x y ) i (“\ ”); printf n ) j (“% = % ”, “ ”, ); printf s d x x ) k (“ % ”, ' '); printf
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: A in ASCII is d A 3. Write a program that asks the user to enter two numbers, obtains the two numbers from the user and prints their sum. 4. Write a program that prints a box, an arrow and a diamond as follows: ******** * * * * *** * * * * ***** * * * * * * * ******** * * 5. What does the following code print? (“*\ **\ ***\ ****\ *****\ ”); printf n n n n n 6. Using techniques you learned so far, write a C program to construct a table similar to the following: number square cube 1 1 1 2 4 8 3 9 27 4 16 64 5 25 125 7. Sketch the steps a C source file goes through to turn into a binary executable (.exe). PS: Many of the problems were copied letter for letter from [DEITEL] Bibliography DEITEL: Deitel, H. M.; Deitel, P. J., C How to Program, 2001 Best Wishes, Ahmed M. Farrag...
View Full Document

This note was uploaded on 01/06/2011 for the course CS 112 taught by Professor Halaabdulgalil during the Spring '10 term at Helwan University, Helwan.

Page1 / 2

sheet1 - A in ASCII is d A 3. Write a program that asks the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online