Search
Log in
Latest topics
Statistics
We have 30 registered usersThe newest registered user is deigavr
Our users have posted a total of 191 messages in 126 subjects
Who is online?
In total there are 2 users online :: 0 Registered, 0 Hidden and 2 Guests None
Most users ever online was 125 on Wed Apr 07, 2021 9:18 am
2nd Program
Page 1 of 1
2nd Program
Objective
To understand the Data Types used.
Theory
Classification of a particular type of information is easy for humans to distinguish between different types of data. We can usually tell at a glance whether a number is a percentage, a time, or an amount of money, that indicate the data's type. Similarly, a computer uses special internal codes to keep track of the different types of data it processes.
Most programming languages require the programmer to declare the data type of every data object, and most database systems require the user to specify the type of each data field. The available data types vary from one programming language to another, and from one database application to another, but the following usually exist in one form or another:
• integer : In more common parlance, whole number; a number that has no fractional part.
• floating-point : A number with a decimal point. For example, 3 is an integer, but 3.5 is a floating-point number.
• character (text ): Readable text
Integer
Integer is a fundamental data type used to define numeric variables holding whole numbers. The integers are the set of numbers consisting of the natural numbers including 0 (0, 1, 2, 3, ...) and their negatives (0, −1, −2, −3, ...). They are numbers that can be written without a fractional or decimal component.
Character
A Character is any symbol that requires one byte of storage. This includes all the ASCII and extended ASCII characters, including the space character. In character-based software, everything that appears on the screen, including graphics symbols, is considered to be a character. In graphics-based applications, the term character is generally reserved for letters, numbers, and punctuation.
Floating-point number
The term floating point is derived from the fact that there is no fixed number of digits before and after the decimal point; that is, the decimal point can float. There are also representations in which the number of digits before and after the decimal point is set, called fixed-point representations. In general, floating-point representations are slower and less accurate than fixed-point representations, but they can handle a larger range of numbers.
Task:
1.Calculate the Gross Pay of a person having Allowance is 15% and House Rent is 10% of the Salary.
Coding
#include<stdio.h>
void main(void)
{
float a,h,g,s;
printf("ENTER SALARY");
scanf("%f",&s);
a=15*s/100;
h=10*s/100;
g=a+h+s;
printf("GROSS AMOUNT IS %f",g);
}
2.Find the Area and Perimeter of a Rectangle, taking Length and Breadth as input and calculate
Area = L * B and Perimeter = 2 * (L + B)
coding
#include<stdio.h>
void main(void)
{
int l,b,area,peri;
printf("ENTER LENGTH");
scanf("%d",&l);
printf("ENTER BREADTH");
scanf("%d",&b);
area=l*b;
peri=2*(l+b);
printf("Area=%d\nPerimeter=%d\n",area,peri);
}
(Created By Ayaz)
To understand the Data Types used.
Theory
Classification of a particular type of information is easy for humans to distinguish between different types of data. We can usually tell at a glance whether a number is a percentage, a time, or an amount of money, that indicate the data's type. Similarly, a computer uses special internal codes to keep track of the different types of data it processes.
Most programming languages require the programmer to declare the data type of every data object, and most database systems require the user to specify the type of each data field. The available data types vary from one programming language to another, and from one database application to another, but the following usually exist in one form or another:
• integer : In more common parlance, whole number; a number that has no fractional part.
• floating-point : A number with a decimal point. For example, 3 is an integer, but 3.5 is a floating-point number.
• character (text ): Readable text
Integer
Integer is a fundamental data type used to define numeric variables holding whole numbers. The integers are the set of numbers consisting of the natural numbers including 0 (0, 1, 2, 3, ...) and their negatives (0, −1, −2, −3, ...). They are numbers that can be written without a fractional or decimal component.
Character
A Character is any symbol that requires one byte of storage. This includes all the ASCII and extended ASCII characters, including the space character. In character-based software, everything that appears on the screen, including graphics symbols, is considered to be a character. In graphics-based applications, the term character is generally reserved for letters, numbers, and punctuation.
Floating-point number
The term floating point is derived from the fact that there is no fixed number of digits before and after the decimal point; that is, the decimal point can float. There are also representations in which the number of digits before and after the decimal point is set, called fixed-point representations. In general, floating-point representations are slower and less accurate than fixed-point representations, but they can handle a larger range of numbers.
Task:
1.Calculate the Gross Pay of a person having Allowance is 15% and House Rent is 10% of the Salary.
Coding
#include<stdio.h>
void main(void)
{
float a,h,g,s;
printf("ENTER SALARY");
scanf("%f",&s);
a=15*s/100;
h=10*s/100;
g=a+h+s;
printf("GROSS AMOUNT IS %f",g);
}
2.Find the Area and Perimeter of a Rectangle, taking Length and Breadth as input and calculate
Area = L * B and Perimeter = 2 * (L + B)
coding
#include<stdio.h>
void main(void)
{
int l,b,area,peri;
printf("ENTER LENGTH");
scanf("%d",&l);
printf("ENTER BREADTH");
scanf("%d",&b);
area=l*b;
peri=2*(l+b);
printf("Area=%d\nPerimeter=%d\n",area,peri);
}
(Created By Ayaz)
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Mon Aug 01, 2011 11:44 pm by Guest
» Netbook Brands
Mon Aug 01, 2011 5:39 am by Guest
» backlinks checker backlink service
Sun Jul 31, 2011 8:56 am by Guest
» how to buy facebook fans f4
Sat Jul 30, 2011 2:34 pm by Guest
» Alle bijzondere dingen in de zaanstreek
Sat Jul 30, 2011 8:11 am by Guest
» HERE YOU CAN POST ALL WEBSITE LINKS...
Wed Aug 26, 2009 2:16 pm by onesimpletech
» cool web site for all must check it
Mon Jul 06, 2009 2:32 pm by Snopy Cobra
» poetry spirit
Mon Jul 06, 2009 2:31 pm by Snopy Cobra
» best to learn VC++
Sun May 10, 2009 3:22 pm by Guest