[go: up one dir, main page]

0% found this document useful (0 votes)
20 views4 pages

Module 01 1102

The document is a lab manual for the CSE 1102 course at Rajshahi University of Engineering & Technology, focusing on basic input/output in C programming. It includes problem statements and practice problems that guide students through creating, compiling, and running C programs, as well as understanding key concepts like case sensitivity, comments, and arithmetic operations. The manual provides specific coding examples and exercises to reinforce learning.

Uploaded by

arafatshitul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views4 pages

Module 01 1102

The document is a lab manual for the CSE 1102 course at Rajshahi University of Engineering & Technology, focusing on basic input/output in C programming. It includes problem statements and practice problems that guide students through creating, compiling, and running C programs, as well as understanding key concepts like case sensitivity, comments, and arithmetic operations. The manual provides specific coding examples and exercises to reinforce learning.

Uploaded by

arafatshitul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Heaven’s Light is Our Guide

Rajshahi University of Engineering & Technology


Department of Computer Science & Engineering

Lab Manual

Course Code: CSE 1102 (Sec A & C)


Course Title: Sessional based on CSE 1101
Module 1 [Basics Input/Output]: (for Week 1)

1. Problem Statement: Familiarize with Codeblocks


i) Create New Project
ii) Open Old Project
iii) Create Source file
iv) Save Source file
v) Compile .c file
iv) Run a .c file

2. Problem Statement:
i). Write the following C program in Codeblocks
ii). Compile the program and run

#include <stdio.h>
main()
{
/* My first program */
printf("Hello World! \n");
}

Now Read the following statements carefully and test it


 C is case sensitive. All commands in C must be lowercase.
 C has a free-form line structure. End of each statement must be marked with a
semicolon. Multiple statements can be on the same line. White space is ignored.
Statements can continue over many lines
 The C program starting point is identified by the word main().
 The two braces, { and }, signify the begin and end segments of the program. In general,
braces are used throughout C to enclose a block of statements to be treated as a unit.
COMMON ERROR: unbalanced number of open and close curly brackets.
 The purpose of the statement #include is to allow the use of the printf statement to
provide program output. For each function built into the language, an associated header
file must be included. Text to be displayed by printf() must be enclosed in double
quotes.
 printf()is actually a function (procedure) in C that is used for printing variables and text.
Where text appears in double quotes "", it is printed without modification. There are
some exceptions however. This has to do with the \ and % characters. These characters
are modifiers, and for the present the \ followed by the n character represents a newline
character.
 The program prints
Hello World!
 And the cursor is set to the beginning of the next line. As we shall see later on, what
follows the \ character will determine what is printed (i.e., a tab, clear screen, clear line,
etc.)
 /* My first program */
Comments can be inserted into C programs by bracketing text with the /* and */
delimiters. As will be discussed later, comments are useful for a variety of reasons.
Primarily they serve as internal documentation for program structure and functionality.
A single line comments can done by //

3. Practice Problem: Write a program to pirnt your name and address in different line by using
i) one printf()
ii) More than one printf()
iii) Use comments

4. Practice Problem: [store data into memory] Write the following programs and run.
i)
#include <stdio.h>
main()
{
int data;
data=10;
printf("%d",data);
}

ii)
#include <stdio.h>
main()
{
int a,b,s;
a=10; b=20;
s=a+b;
printf("s=%d",s);
}

5. Practice Problem: Write a program that stores two integers in x and y. Now write codes
to find i) x+y ii) x-y iii) x*y and iv) x/y

6. Practice Problem: Write a program that calculate the area of a triangle if three sides are
given.
Snapshot of the program
Enter Three sides: 3 4 5
Area=6.0
7. Practice Problem: Write a program that calculate the area of a triangle if three vertices
are given.
Snapshot of the program
Enter First vertex: 2 2
Enter Second vertex: 2 0
Enter Third vertex: 5 0
Area=3.0

8. Practice Problem: Write a program that calculate the total bill of a Fast Food Restaurant.
There are 4 types of items are available in the restaurant such as: 1) Burger ii) Sandwich iii)
Pizza and iv) Cold Drinks. Assume prices of Burger=200 Tk., Sandwich=75 Tk. , Pizza=750 Tk. And
Cold Drinks=40 Tk.

Snapshot of the program


Enter NO. of Burgers, Sandwiches, Pizzas, Cold Drinks: 1.0,1,3
Total Bill=1170
Payment=1200
Return=130

You might also like