BASIC C PROGRAMMING AND TRICKS-TECHNOLOGIES-TECHNICALS
Add two number in c language
Get link
Facebook
X
Pinterest
Email
Other Apps
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,sum=0;
clrscr();
printf("enter a value for a=");
scanf("%d",&a);
printf("enter value for b=");
scanf("%d",&b);
sum=a+b;
printf("%d",sum);
getch();
}
what is printf() and scanf () roll in C language ? printf() and scanf() functions are inbuilt library functions in C programming language which are available in C library by default. These functions are declared and related macros are defined in “stdio.h” which is a header file in C language. We have to include “stdio.h” file as shown in below C program to make use of these printf() and scanf() library functions in C language. printf() and scanf() are basic function of C language.
#include<stdio.h> #include<conio.h> void main() { int a; printf("Enter a value which you want to check="); scanf("%d",&a); if(a%2==0) { printf("a is even"); } else { printf("a is odd"); } getch(); }
Comments
Post a Comment