Data Types Simple C Program
Data Types Simple C Program
SIMPLE C
PROGRAM
C Data Types
float “%f” Used for outputting numbers with 8.12, 16.06 -23.813
decimal places
void Valueless
Basic Arithmetic Operation
SYMBOL DESCRIPTION
+ Used in addition
- Used in subtraction
/ Used in division
* Used in multiplication
Increment
++
Decrement
--
#include<stdio.h>
void main()
{
char name [10];
int age;
getch ();
}
/*This program adds and multiplies two values*/
#include<stdio.h>
void main()
{
int a , b , c , e;
c = a+b;
e = a*b;
printf("\nThe sum of the two values is %d",c);
printf("\nThe product of the two values is %d",e);
getch();
}
#include<stdio.h> printf("\nThe sum of the two values is %.3f",c);
void main() printf("\nThe product of the two values is %.3f",e);
{
printf("\nThe difference of the two values is %.3f",f);
float a , b , c , e, f, g; printf("\nThe product of the two values is %.3f",g);
getch();
printf("\n\n Enter your }
first value:");
scanf("%f", &a) ;
c = a+b;
e = a*b;
f = a-b;
.3f – up to three decimal places only
g = a/b;