slide03 - ICS 103 Computer Programming in C Handout-3 Topic Assignment Input and Output statements Objective To know about assignment statement of C To

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

This preview shows page 1 - 3 out of 6 pages.

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
Image of page 1
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.
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 6 pages?

  • Spring '10
  • zaman
  • printf, tab character

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes