✔ Now today we are learning about all basic data
type with their one – one examples.
Let’s start with Int Data Type
1. Program for Int Data Type:
#include<stdio.h>
#include<conio.h>
#include<conio.h>
void main()
{
int no;
clrscr();
printf("Enter your roll no\n");
scanf("%d",&no);
printf(“*
* * *
* * *
* * *
* * *
* * *
* * * * \n”);
printf("Your Roll No is %d
\n",no);
printf(“*
* * *
* * *
* * *
* * *
* * *
* * * * \n”);
getch();
}
Output:-
Note:- Program is purely based on user
define so the value is given by user at run time.
*
* * *
* * *
* * *
* * *
* * *
* * * *
Your Roll No is _____ { value is Enter by
user} , If user enter 17 then output will like this
Your Roll No is 17
*
* * *
* * *
* * *
* * *
* * *
* * * *
2. Program for Char Data Type:
✔ Now we can use %s or %c any one of them for
scan a variable.
✔ Now for space value like if I want to enter
my full name so in “Char only those character will see which is write before a
space”.
✔ For example :- if I write Sachin Raval Then
Output will only Sachin (Raval is not showing because it’s after space).
✔ So in below program you will learn this
trick how to see full name in turbo c.
#include<stdio.h>
#include<conio.h>
void main()
#include<conio.h>
void main()
{
char name[10];
clrscr();
printf("Enter your name\n");
scanf(" %[^\n]",&name);
printf(" * * * * * * * * * * * * * * *
\n");
printf("Your Name is %s
\n",name);
printf(" * * * * * * * * * * * * * * *
* \n");
getch();
}
Output:-
Note:- Program is purely based on user
define so the value is given by user at run time.
*
* * *
* * *
* * *
* * *
* * *
* * * *
Your Name is _____ { value is Enter by
user} If user write “Sharma Rahul Vijaykuamr” Then output will
Your Name is Sharma Rahul Vijaykuamr
*
* * *
* * *
* * *
* * *
* * *
* * * *
#include<stdio.h>
#include<conio.h>
#include<conio.h>
void main()
{
float per;
clrscr();
printf("Enter your
percentage\n");
scanf("%f",&per);
printf(" * * * * * * * * * * * * * * *
\n");
printf("Your Percentage is %f
\n",per);
printf(" * * * * * * * * * * * * * * *
* \n");
getch();
}
Output:-
Note:- Program is purely based on user
define so the value is given by user at run time.
*
* * *
* * *
* * *
* * *
* * *
* * * *
Your Percentage is _____ { value is Enter
by user} if user enter 78.28 then output will
Your Percentage is 78.28
* *
* * *
* * *
* * *
* * *
* * * *
* *
#include<stdio.h>
#include<conio.h>
#include<conio.h>
void main()
{
double cn;
clrscr();
printf("Enter your contact
no\n");
scanf("%lf",&cn);
printf(" * * * * * * * * * * * * * * *
\n");
printf("Your Contact No is %lf
\n",cn);
printf(" * * * * * * * * * * * * * * *
* \n");
getch();
}
Output:-
Note:- Program is purely based on user
define so the value is given by user at run time.
*
* * *
* * *
* * *
* * *
* * *
* * * *
Your Contact Number is _____ { value is
Enter by user} is your enter 778***78** then output will
Your Contact Number is 778***78**
*
* * *
* * *
* * *
* * *
* * *
* * * *
⭐Thank you⭐
0 Comments
If any one want learn some specific program in Computer Languages, so They all can comment there program questions.