03 C Programming
03 C Programming
INDEX
1 Printf and Scanf in c
2 Comments in C
The printf() and scanf() functions are used for input
and output in C language.
printf("format string",argument_list);
#include<stdio.h>
#include<conio.h>
void main(){
int a = 10;
printf("%d",a);
}
Float
#include<stdio.h>
#include<conio.h>
void main(){
float b = 10.20;
printf("%f",b);
getch();
}
Char
#include<stdio.h>
#include<conio.h>
void main(){
char c = 'c';
printf("%c",c);
getch();
}
Double
#include<stdio.h>
#include<conio.h>
void main(){
double d = 465.568;
printf("%.3lf",d);
getch();
}
scanf() function
scanf("format string",argument_list);
Get Value from user
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
getch();
}
Program to print sum of given number :
#include<stdio.h>
#include<conio.h>
void main(){
int a;
int b;
int sum;
sum = a+b;
printf("Total is : %d",sum);
}
OUTPUT :
COMMENTS IN C
Comments in C language are used to provide
information about lines of code.
void main(){
/*printing
information*/
printf("Hello C");
}
*****************************************************