https://github.com/akhil-peram/c-programming
Programs for C Language
https://github.com/akhil-peram/c-programming
c programming
Last synced: 9 months ago
JSON representation
Programs for C Language
- Host: GitHub
- URL: https://github.com/akhil-peram/c-programming
- Owner: Akhil-peram
- Created: 2021-12-27T16:17:33.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-19T14:29:42.000Z (11 months ago)
- Last Synced: 2025-04-13T15:16:57.223Z (9 months ago)
- Topics: c, programming
- Language: C
- Homepage:
- Size: 70.3 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# C Programming
### Variables
### Data Types
### Conditional Statements
### Files and Exceptions
### Structures and Unions
A Simple Hello world program in C Language
#include
int main()
{
printf("Hello World\n");
return 0;
}
C language was developed by Dennis Ritchie
Include function includes the header file which is
Stdio stands for standard Input and Output ( .h ) represents the header file
**Input and Output**
printf is used to display the output of the given data in C
#include
int main(){
int a=3,b=6;
int x=a+b;
printf("sum = %d",x);
}
Scanf is used to take input from the user
To access the address of the input C uses ampersand (&) to store the address.
FORMAT SPECIFIERS
• To access the address of the given data and to write the data into variables C uses these format specifiers for assigning address
For int %d or %i
Float %f
String %s
Char %C
Program
#include // Header file
int main(){ // main function
int a =1; // declaring variables and initializing values
float b=2;
char c='a';
printf(" %d\n%f\n%c",a,b,c); // printing the variables
}
**Manipulation of data types**
To do math in C we use int , float data types
* Addition (+)
* Subtraction(-)
* Multiplication(*)
* Division (/)
* floor Division(//)
*Calculations in c*
#include
int main()
{
int a=3,b=2;
printf("sum = %d",a+b);
printf("Subtraction = %d",a-b);
print("Multiple = %d",a*b);
float x= 36.14;
float y= 6.2;
printf("division =%f",x/y);
return 0;
}
- For taking input we use scanf function to take input from user
#include
int main(){
printf("Enter two numbers ");
int a , b,c; //declaring variables
scanf("%d %d",&a,&b);
c=a+b;
printf("\nsum of numbers is %d",c);
}
# Operators
The operators for manipulating data in C divided into
* Arithmetic operators
#include
int main(){
int a = 10, b=90;
printf("Sum of a +b is %d",a+b);
return 0;
}
* Conditional operators
* Logical operators
* Bitwise operators
# Variables
*Variables* : Anything that stores the value .
* int cars= 10 ,
* float speed = 143.789 ,
* double pi = 3.1428579631274639 ,
* char letter ='L',
* string = "I am Ironman";
A variable can be anything that can store the values of specified format
# Control Statements
## Control flow
* if
* else if
* else
* switch cases
### Loops
* for loop
* while loop
* do while loop