0% found this document useful (0 votes)
14 views

Programming Fundamentals Lab1

The document provides an introduction to programming fundamentals, including key concepts such as variables, data types, constants, and keywords. It outlines rules for naming variables, explains the purpose of printf and scanf functions, and describes the compilation process. Additionally, it includes two programming tasks focused on printing variable values and adding two integers based on user input.

Uploaded by

dev.faisee
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Programming Fundamentals Lab1

The document provides an introduction to programming fundamentals, including key concepts such as variables, data types, constants, and keywords. It outlines rules for naming variables, explains the purpose of printf and scanf functions, and describes the compilation process. Additionally, it includes two programming tasks focused on printing variable values and adding two integers based on user input.

Uploaded by

dev.faisee
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Programming

Fundamentals
LAB 1
WHAT IS PROGRAMMING…?

Programming:
• Programming is giving a set of instructions to a computer to execute.
Programming Fundamentals:
• Fundamental programming concepts include a set of basic principles and
related terminologies that programmers follow to write code that is simple to
understand, modular, and efficient.
Variables
• Variable is the name of a memory location
which stores some data.
Rules:
1) Variables are case sensitive.
2) 1st character is alphabet or ‘_’
3) No comma/blank space.
4) No other symbol other than ‘_’
Data Types

In Programming, data type is an


attribute associated with a piece of data
that tells a computer system how to
interpret its value. Understanding data
types ensures that data is collected in
the preferred format and that the value
of each property is as expected.
Constants

Constant is an entity that does not


change(fixed).
Keywords

Reserved words that have special


meaning
to the compiler.
32 Keywords in C
Program Structure
Printf & Scanf
printf is for printing character, the ‘printf’ is a powerful and
versatile object.
scanf is for character in, the ‘scanf’ receives input from the
keyboard.
Syntax of scanf is as follows:
scanf (“%d”, &variable name);
Let variable name is ‘a’
scanf (“%d”, &a);
FORMAT SPECIFIERS
Compilation

A computer program that translates C code into machine code


TASK 1
1. Write a program to print the value of a integer and a float
variable.
Values must be hard coded.
Show the output in following form:
The value of integer is ___
The value of float is
TASK 2
2. Write a simple program to add two integers, Ask the user to enter input of
integer values.
Write a formula for addition. Store the result in a separate integer.
The input must follow the following format:
Enter value for integer a.
Enter value for integer b.

Show the output in this form:


The sum of two integers is:

You might also like