Skip to Main Content
Fundamentals of Computer Programming and IT by Pearson
book

Fundamentals of Computer Programming and IT by Pearson

by Ashok Namdev Kamthane, Rohit Khurana
May 2024
Intermediate to advanced content levelIntermediate to advanced
577 pages
22h 34m
English
Pearson India
Content preview from Fundamentals of Computer Programming and IT by Pearson
270 Fundamentals of Computer Programming and IT
Write a program to demonstrate implicit type conversion.
# include <iostream.h>
# include <conio.h>
void main()
{
clrscr();
int j=2.54;
int k=’A’;
char c=87.5;
cout <<“ j= “<<j;
cout<<endl<<“ k= “<<k;
cout<<endl<<“ c= “<<c;
}
OUTPUT:
j= 2
k= 65
c= W
Explanation
The above program works as described in Table 9.5.
Example 9.10
Table 9.5 Examples of Implicit Type Conversion
Expression Output
int j=2.54
A float value is assigned to integer variable. Here, 2 is assigned to j and fractional part will get
vanished.
int k=’A’;
A char type value is assigned to integer variable. Here, ASCII value of ‘A’ (65) is assigned ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Basic Computer Engineering (Subject Code: BE - 205)  by Pearson

Basic Computer Engineering (Subject Code: BE - 205) by Pearson

Anita Goel, Anand Motwani

Publisher Resources

ISBN: 9781299447479