3 - COMP1511 - Programming Fundamentals - 18s1.pdf - COMP1511 Programming Fundamentals 18s1 COMP1511 18s1(webcms Code Examples from Lectures on if

3 - COMP1511 - Programming Fundamentals - 18s1.pdf -...

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

02/12/2018 COMP1511 - Programming Fundamentals - 18s1 1/4 larger_a.c A simple program demonstrating the use of scanf and if statements #include < stdio . h > int main ( void ) { int a , b ; printf ( "Enter a: " ); scanf ( "%d" , & a ); printf ( "Enter b: " ); scanf ( "%d" , & b ); if ( a > b ) { printf ( "a is greater than b\n" ); } else if ( a < b ) { printf ( "a is less than b\n" ); } else { printf ( "a is equal to b\n" ); } return 0 ; } larger_b.c A simple program demonstrating the use of scanf and if statements #include < stdio . h > int main ( void ) { int a , b ; printf ( "Enter a: " ); scanf ( "%d" , & a ); printf ( "Enter b: " ); scanf ( "%d" , & b ); if ( a > b ) { printf ( "%d is greater than %d\n" , a , b ); } else if ( a < b ) { printf ( "%d is less than %d\n" , a , b ); } else { printf ( "%d is equal to %d\n" , a , b ); } return 0 ; } absolute.c Convert a measurement in feet to metres A simple program demonstrating the use of scanf, printf and an if statement COMP1511 18s1 (webcms) Code Examples from Lectures on if COMP1511 18s1 (flask)
Image of page 1

Subscribe to view the full document.

02/12/2018 COMP1511 - Programming Fundamentals - 18s1 2/4 #include < stdio . h > int main ( void ) { int x ,
Image of page 2
Image of page 3
  • Spring '18
  • Ahmed Zeki

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

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes