C Programming Language
C Programming Language
C Programming Language
PERSENTATION AT “C LANGUAGE”
(C PROGRAMMING LANGUAGE AT L&B)
ESTABLISHED
Ternary operator ( ?, :)
CONDITIONAL STATEMENT
C has the following conditional statements:
Use if:- to specify a block of code to be executed, if a
specified condition is true.
if(condition){
// Do something if true
}
Use if-else:- to specify a block of code to be executed, if the
same condition is false.
if(condition){
// do something if true
}
else {
// Do somethig if true
}
Use else if to specify a new condition to test, if the first
condition is false.
if(condition){
// Do something if true
}
else-if {
//Do something if true/ false
}
else-if {
//do something if ture/false
}
else{
//do somethig if true
}
Use switch to execute more than 2 conditions/ statement
at a time and in a single program
For Example:-
Switch(condition){
case:1 //Do something
break;
case: 2 //Do something
break;
default : // do something
break;
}
LOOPS
For loop
do{
//do something
updation
} while(condition);
PROGRAM:- WRITE A PROGRAM TO CALCULATE SUM
OF ALL NUMBER BETWEEN 5 TO 50
#include <stdio.h>
int main() {
int marks ;
printf("Enter marks: /n ");
scanf("%d", &marks);
for (marks < 30) {
printf(“ Grade is C: \n”);
}
else if (marks >= 70 && marks < 70){
Printf(“ Grade is B: \n”);
}
else if( marks>= 70 && marks<= 90){
Printf(“ Grade is A: \n”);
}
else{
Printf(“ Grade is A+: \n”);
}
return 0;
}
OUTPUT
Enter marks : 45
Grade is : B
BIBLIOGRAPHY
Training report
Google
Wikipedia
Javatpoint
Books