Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
56 views

CSE 1201 Programming Lab 1

This document outlines the objectives and tasks for a lab session on C fundamentals. The objectives are to install a C programming environment, write simple C programs using printf() and scanf(), variables of different data types, and basic math operators. The tasks involve writing programs that print text, calculate the sum, product, and average of hard-coded and user-input numbers. The homework is to write a program collecting two user-input numbers, comparing them, and calculating either the sum or product based on which is greater.

Uploaded by

iatfirmforyou
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

CSE 1201 Programming Lab 1

This document outlines the objectives and tasks for a lab session on C fundamentals. The objectives are to install a C programming environment, write simple C programs using printf() and scanf(), variables of different data types, and basic math operators. The tasks involve writing programs that print text, calculate the sum, product, and average of hard-coded and user-input numbers. The homework is to write a program collecting two user-input numbers, comparing them, and calculating either the sum or product based on which is greater.

Uploaded by

iatfirmforyou
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

CSE 1201 – Introduction to Programming with C

Lab 1 – C Fundamentals

Objectives

By the end of this lab sessions students should be able to:

• Install a C Programming Environment


• Write, save, run simple C programs
• Use the printf() function in C
• Write simple C programs that uses variables to store various types of data
• Write simple C programs that uses basic mathematical operators
• Perform basic input using scanf() function

Tasks

1. Write, save, run a C program that prints “hello world” to the screen
2. Modify the above program so that it prints additional text output to the screen
3. Write a C program that finds and prints the sum of two numbers. These numbers are hard-
coded in the program
4. Modify the program in 3 above to find the product and average of these two numbers.
5. Write a program in C that collects TWO values from the keyboard and repeat problem 4 above.
Use a single scanf() for all data entry
6. Re-write the program in 5 above using functions as appropriate. Call these function from main()

Homework

1. Write a program in C that collects two numeric values from the user via the keyboard and finds
the sum of the two numbers if the first number entered is greater than the second OR the
product of the two numbers if the second is greater than the first. These two numbers are to be
stored in variables called first_num and second_num. This program must use functions.

You might also like