5. WRITE A C PROGRAM TO EXPLAIN FORMATTED OUTPUT FUNCTION “PRINTF”

/*C program to explain formatted output function “printf”*/

#include<stdio.h>
#include<conio.h>
int main()
{
int a,b;
clrscr();
printf(“enter a value”);
scanf(“%d”,&a);
printf(“\naccepted value is %d”,a);
printf(“\nenter b value”);
scanf(“%d”,%b);
printf(“\naccepted value is %d”,b);
printf(“\n their sum is %d”,a+b);
getch();
return 0;
}

output

Enter a value 102
Accepted value is 102
Enter b value 268
Accepted value is 268
Their sum is 370

Comments