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

Fundamentals of Programming

An activity on assigning values into data types and variables

Uploaded by

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

Fundamentals of Programming

An activity on assigning values into data types and variables

Uploaded by

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

Activity #2

• Variables
• Data types
Instructions:

1.Introduction to Data Types


1. Review the following data types and their purposes:
1. int: stores whole numbers.
2. double: stores floating point numbers with
decimals.
3. char: stores single characters.
4. string: stores text.

2.Exercise 1: Declaring and Initializing Variables


1. Open your IDE or text editor.
2. Write a simple program to declare and initialize
variables for each data type
Exercise 2: Manipulating and Printing Variables

•Modify your program to perform the following tasks:


•Add 10 to the integer variable.
•Multiply the double variable by 2.5.
•Change the character variable to 'A'.
•Concatenate the string variable with another string, " World".

•Print the results of each modification to the console.

--see example next page…

You might also like