hot post

Input/output instruction in c(part 8)

Input/output instruction in c

Hello friends,

Input/output instruction in c-  

Today we will see (Part 8) in this language learning series.we are looking input/output instruction in c languages. Earlier we understood the use of printf in Part 6 and Part 7.We saw that with the help of printf, we can print any message on the output screen and also we understood about gotoxy function.


Input/output instruction in c(part 8)
Input/output instruction in c(part 8) 

Today we have to see another use of print by which we will understand how we can print the variable or any expression in the output screen.
lets take an example and understand the topic:
Now watch this coding carefully


#include<stdio.h>
#include<conio.h>
void main()
{
int a=8,b=10
clrscr();
printf("%d",a,b);
getch();
}


If we have written int a=8 and b=10, we have covered it in the previous post, so please see the previous part.

what is %d?

% d is a special symbol that does not print itself, rather it prints the variable or expression value in its place.


 Format specificationSymbol starting with% is called format specification.
When and how we use them, now we know this

 Format specification                              store      
%d                                                        integer(int)
%f                                                     decimal(float)
%c                                                  character(char)
%ly                                                 double(double)



We can print this message in more ways like we want to print (value of A is  8 and B is 10) so we will write code


#include<stdio.h>
#include<conio.h>
void main()
{
int a=8,b=10
clrscr();
printf("value of a is %d and b is %d ",a,b);
getch();
}


Now if we want to sum the value of A&B, then how will we do it? lets see


#include<stdio.h>
#include<conio.h>
void main()
{
int a=8,b=10
clrscr();
printf("sum of  %d and %d is %d ",a,b,a+b);
getch();

}


As soon as we run it, the a and b will be added and we will be able to see this result in the output screen.
So now we have made a program to add

So now in the next part we will see how we will use the scanf function to take input from the user.

 I am trying my best to explain the c language to you, please stay with me and share this post and if there is any mistake then you comment on comment box thanks for support
    
part 1 - (Basics-of-C-language)
part 2 - (Fundamental-terminologies)
part 3 - (introduction-of-c-language)
part 4 - (identifiers-in-c-language)
part 5 - (data-type-declaration-instruction-in-c.)
part 6 - (Input-Output-instruction-in-C)
part 7- (Input-Output-instruction-in-C)









Post a Comment

0 Comments