slide03 - ICS 103 Computer Programming in C Handout-3 Topic...

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

View Full Document Right Arrow Icon
ICS 103: Computer Programming in C Handout-3 Topic: Assignment, Input and Output statements. Objective : To know about assignment statement of C. To know how to perform I/O operations in C. To know use of new line character \n and tab character \t in printf function. To know about general form of C programs. To know how to format numbers in program outputs. Assignment Statements : Syntax: result=expression ; In this left hand side must be single variable name. Example : x=x+z+2.0;       OR a=5; In this = is known as  assignment operator Input / Output Operations : Use of scanf function for reading input from keyboard : Syntax : scanf(format string, input list separated by coma ); Example : scanf(“%d  %c”, &age, &first_initial ); Use of printf function for displaying output on the screen of the Computer System : Page 1 of 6
Background image of page 1

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

View Full Document Right Arrow Icon
Syntax : printf(format string, print list);              OR printf(format string);  Example : printf(“I am %d years old, and my GPA is %f\n”, age, gpa); OR printf(“Enter radius of circle : “ ); Note :   as explained in 2nd Lecture placeholders/conversion specifiers/ format characters for  printf and scanf functions are : Variable type             scanf / printf Placeholders or Conversion Specifiers char                                                              %c int                                                                %d float                                                             %f double                                                         %lf Use of new line character \n and tab character \t in printf function :   This new line character  \n  in the  printf  statement causes the next output to be printed on the  new line. The tab character  \t  causes the next output to be printed at the next tab position. Example :
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 6

slide03 - ICS 103 Computer Programming in C Handout-3 Topic...

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

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