CREATED
C is a general-purpose, high-level language that was originally developed by Dennis M.
Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC PDP-11 computer in 1972.
- Easy to learn
- Structured language
FIRST WE NEED NOW ABOUT DATA TYPE :
| Data Type | Maximum Value | Minimum Value |
|---|---|---|
| int | 2,147,483,647 | - 2,147,483,648 |
| float | 3.4028235E38 | 1.4E-45 |
| double | 1.7976931348623157E308 | 4.9E-324 |
| char | 65,535 | 0 |
| short | 32767 | -32768 |
| long | 9223372036854775807 | -9223372036854775808 |
INT =Is used fot number.
eg:
int a;
a=10;
like that we are using.
SAME AS ALL THE DATA TYPE :
FLOT= Is used for decimal point value assign
CHAR= Is used for character assign
printf= Is used for print the output ex: first program if you change inside the ("") with your name it will dispaly the output in your name printf("jmsoftware\n");
# is a preprocessor directive
stdio.h=standard input and output header file it a meaning for this line .
we see the example program :
Example 1 - C hello world program
/** My first C program */
/** My first C program */
#include <stdio.h>
int main()
{
printf("Hello World\n");
return 0;
}
int main()
{
printf("Hello World\n");
return 0;
}
Output of program:
"Hello World"
"Hello World"
Example 2 - C program to get input from a user using scanf
#include <stdio.h>
int main() // the compiler start to compile at int main
{
int x;
{
int x;
printf("Input an integer\n");
scanf("%d", &x); // %d is used for an integer
scanf("%d", &x); // %d is used for an integer
printf("The integer is: %d\n", x);
return 0;
}
}
Output:
Input an integer
7897
The integer is: 7897
Input an integer
7897
The integer is: 7897
No comments:
Post a Comment