Let us c (by yashvant kanetkar) chapter 1 solution

It includes the solution of chapter 1st of 5th and 12th edition of let us C.

Let us C
(by yashvant Kanetkar) chapter 1
Solution
Written by
Hazrat Bilal(student at AWKUM)
&
Muhammad Ishfaq Khan(student at AWKUM)
Revised by
Maimoona Jahanzeb Khattak(student at AWKUM)
A. Which of the following are invalid variables name and why?
1) BASICSALARY
It is a valid variable.
2) _basic
It is a valid variable.
3) basic-hra
Hypen is not valid between two words.
4) #MEAN
# is invalid in the name of variable.
5) group.
Full stop is not applicable in the name of
variable. 6) 422
Variable name is the combination of letters and digits, not only digits.
7) population in 2006
There is the gap between the words ,there should not be any gap.
8) over time
Mistake of a gap
9) mindovermatter
It is a valid variable
10) FLOAT
Valid variable
11) hELLO
It is a valid variable
12) queue.
Mistake of a full stop
13) team’svictory
 ‘ is not applicable in the name of variable.
14) Plot # 3
Mistake of a gap.
15) 2015_DDay
Variable starts with digit is not aplicabble.
B. Point out the errors,if any, in the following
C statement:
a) Int=314.562*150;
Intis a variable name of integer but the value of integer is
not integer ,its basically float.
b) name=`Ajay’;
Name is a character variableso in between there should only one
letter or digit or special symbol, and inverted comma is not like
that.
c) Varchar=`3’;
Mistake of inverted comma.
d) 3.14*r*r*h=vol_of_cyl;
Variable name must be on left side.
e) k=(a*b)(c+(2.5a+b)(d+e);
k-(a*b)*(c*+(2.5*a+b)*(d+e);
f) m_inst=rate of interest*amount in rs;
Wrong becauseof gap between variable name.
g) si=principal*rateofinterset*numberofyears/100;
Proper formatis: (principal*rateofinterest*numberofyears)/100;
h) area=3.14*r**2;
There is no meaning of** in C .
i) volume=3.14*r^2*h;
There is no meaning of r^2 in C.
j) k=((a*b)+c)(2.5*a+b);
K=(a*b)+c)*(2.5*a+b);
k) a=b=3=4;
Proper format:(a=3 or a=4)or (b=3 or b=4).
l) count=count+1;
Valid.
m) date=’2 mar 04’;
Space between variable is not variable and character is of only one
letter,digit or special symbol.
C. Evaluate the following expressions and show
their hierarchy.
a) g=big/2+big*4/big-big+abc/3;
(abc=2.5,big=2,assumeg to be a float)
g=2/2+2*4/2-2+2.5/3;
g=1+2*4/2-2+0.8
g=1+4-2+0.8
g=3.8
b) on=ink*act/2+3/2*act+2+tig;
(ink=4,act=1,tig=3.2,assumeon to be an int)
on=4*1/2+3/2*1+2+3.2;
on=2+1.5+2+3.2
on=8.7 (but on integer variable its value will be 8)
c) s=qui*add/4-6/2+2/3*6/god;
(qui=4,add=2,god=2,assumes to be an int
s=4*2/4-6/2+2/3*6/3;
s=8/4-6/2+0.6*3
s=2-3+0
s=-1
d) S=1/3*a/4-6/2+2/3*6/g;
(a=4,g=3,assumes to be an int)
S=1/3*4/4-6/2+2/3*6/2;
S=0*4/4-3+0*6/3;
S=-3
D. Fill the following table for the expressions given
below and then evaluate the result.A sample
entry has been filled in the table for
expression(a).
operator left right remark
/ 10 5 or 5/2/1 Left operand
is
unambigous,
right is not
.. .. .. ..
a) g=10/5/2/1;
 =2/2/1
=1/1
=1
b) b=3/2+5*4/3;
 =1+20/3
=1+6
=7
c) a=b=c=3+4;
a=b=c=7
E.Convert the following equations into
corresponding C statements.
a)Z=8.8(a+b)2/c-0.5+2a/(q+r)
(a+b)*(1/m)
= 8.8*(a+b)*2/c-0.5+2*/(q+r)/((a+B)*(1/m)).
b)X= -b+(b*b)+2 4ac
2a
=(-b+(b*b)+2*4*a*c)/2*a.
c) R= 2v+6.22(c+d)
g+v
=(2*v+6.22*(c+d))/g+v.
d) A= 7.7b(xy+a)/c-0.8+2b
(x+a)(1/y)
=(7.7*b*(x*y+a)/c-0.8+2*b)/((x+a)*(1/y)).
F.What would be the output of following
programs?
a) main()
{
int i=2,j=3,k,l;
float a,b;
k=i/j*j;
l=j/i*i;
a=i/j*j;
b=j/i*i;
printf(“%d %d %f %f”,k,l,a,b);
}
Output:
O
2
0.000
2.000
b) main()
{
inta,b;
a=-3- -3;
b=-3- -(-3);
printf(“a=%d b=%d”,a,b);
}
Output:
Error.
c) main()
{
int a=5,b=2;
int c;
c=a%b;
printf(“%d”,c);
}
Output:
1
d) main()
{
printf(“nnnn nnn”);
printf(“nn/n/n nn/n”);
}
Output:
nn
nn
Nn /n/n nn/n
e) main()
{
int a,b;
printf(“enter values of a and b”);
scanf(“%d %d”,&a,&b);
printf(“a=%d b=%d”,a,b);
}
Output:
Enter values of a and b 34 23
a=34
b=23
f) main()
{
int p,q
printf(“enter values of p and q”);
scanf(“%d%d”,p,q);
printf(“p=%d q=%d”,p,q)
Output:
Enter values of p and q 23 34
p=23 q=34
G.Pick up the correct alternative for each of the
following questions:
a) C language has been developed by
1. Ken Thompson
2. Dennis Ritchie√
3. Peter Norton
4. Martin Ritchards
b) C can be use on
1. Only MS-DOS operating system
2. Only Linux operating system
3. Only windows operating system
4. All the above√
c)
1.
C programs are converted into machine language with the
of
An editor
help
2. A compiler√
3. An operating systmem
4. None of the above
d)
1.
The real constant in C can be expressed on which of
following forms
Fractional form only
the
2. Exponential form only
3. ASCII form only
4. Both fractional and exponential forms√
e)
1.
A character variable can at a time store
1 character √
2. 8 characters
3. 254 characters
4. None of above
f)
1.
The statement char ch=’Z’ would store in ch
The character Z √
2. ASCII value of Z
3. Z along with the single inverted commas
4. Both (1) ans (2)
g)
1.
Which of the following is not a character constant
‘Thank You’
2. ‘Enter values of P,N,R
3. ‘23.56E-03’
4. All the above √
h)
1.
The maximum value that an integer constant can have
-32767
is
2. 32767 √
3. 1.7014e+38
4. -1.7014e+38
i) A C variable cannot start with
1. An alphabet
2. A number
3. A special symbol other than underscore
4. Both (2)&(3) above √
j) Which of the following statement is wrong
1. mes=123.56;
2. con=’T’*’A’;
3. this=’T’*20;
4. 3+a=b; √
k) Which of the following shows the correct hierarchy of
arithmetic operators in C
1. **,*or/,+or-
2. **,*,/,+,-
3. **,/,*,+,-
4. /or*,-or+ √
l) In b=6.6/a+2*n;which operation will be performed first?
1. 6.6/a √
2. a+2
3. 2*n
4. Depends upon compiler
m) Which of the following is allowd in a C arithmetic
instruction?
1. []
2. {}
3. () √
4. None of the above
n) Which of the following statement is false
1. Each new C instruction has to be written on separate line√
2. Usually all C statements are in small case letters
3. Blank spaces may be inserted between two words in a C
statement
4. Blank spaces cannot be inserted within a variable name
o) If a is an integer variable, a=5/2; will return a value
1. 2.5
2. 3
3. 2
4. 0 √
p) The expression,a=7/22*(3.14+2)*3/5;evaluates to
1. 8.28
2. 6.28
3. 3.14
4. 0 √
q) The expression ,a=30*1000+2768;evaluates to
1. 32768 √
2. -32768
3. 113040
4. 0
r) The expression x=4+2%-8 evaluates to
1. -6
2. 6 √
3. 4
4. None of the above
s) Hierarchy decides which operator
1. Is most important
2. Is used first√
3. Is fastest
4. Operates on largest numbers
t) An integer constant in C must have
1. At least one digit √
2. At least one decimal point
3. A comma along with digits
4. Digits separated by commas
u)
1.
A character variable can never store more
32 characters
than
2. 8 characters
3. 254 characters
4. 1 character √
v)
1.
In C a variable cannot contain
Blank spaces
2. Hyphen
3. Decimal point
4. All the above √
w) Which of the following is false in C
1. Keywords can be used as variable names√
2. Variable names can contain a digit
3. Variable names donot contain a blank space
4. Capital letters can be used in variable names.
x) In C, arithmetic instruction cannot contain
1. Variables
2. Constants
3. Variable names on right side of= √
4. Constants on left side of=
y) Which of the following shows the correct hierarchy of
arithmetic operations in C
1. /+*-
2. *-/+
3. +-/*
4. */+-√
z) What will be the value ofd if d is a float afterthe operation
d=2/7.0?
1. 0
2. 0.2857
3. Cannot be determined
4. None of the above
H. Write C programs for the following.
a) Ramesh’s basic salary is input through the keyboard.his
dearness allowance is 40% of basic salary,and house rent
allowance is 20% of basic salary.Write a program to clculate
his gross salary.
#include<stdio.h>
#include<conio.h>
main()
{
float bs,da,hra,gs;
Clrscr();
printf(“enter the Ramesh’s basic salary=”);
scanf(“%f”,&bs);
da=(bs*40)/100;
printf(“dearness allowance=%f”,da);
hra=(bs*20)/100;
printf(“house rent allowance=%f”,hra);
gs=bs-(da+hra);
printf(“ramesh’s gross salary=%fn”,gs);
getch();
}
b) The distance between two cities(in km)is input through the
keyboard.write a program to convert and print this distance
in meters,feet,inches and centimeters.
#include<stdio.h>
#include<conio.h>
main()
{
float distance,m,ft,in,cm;
Clrscr();
printf(“Enter the distance between two cities in km=”);
scanf(“%f”,&distance);
m=distance*1000;
printf(“m=%f”,m);
ft=distance*1000*3.25;
printf(“ft=%f”,ft);
in=distance*1000*3.25*12;
printf(“in=%f”in);
cm=distance*1000*3.25*12*2.5;
printf(“cm=%f”,cm);
getch();
}
c) If the marks obtainedby a studentin five different subjects
are inputthrough thekeyboard , find outthe aggregatemarks
and percentage marks obtained by the student. Assume that
the maximum marks that can be obtained by a student in each
subject is 100.
#include<stdio.h>
#include<conio.h>
main()
{
float P1,P2,P3,P3,P4,P5,sum,per,total=500;
clrscr();
printf(“enter the marks of 5 subjects=”);
scanf(“%f %f %f %f %f”,&P1,&P2,&P3,&P4,&P5);
sum=P1+P2+P3+P4+P5;
per=(sum*100)/500;
printf(“aggregate marks=%fn”,sum);
printf(“percentage marks=%fn”,per);
getch();
}
d) Temperature of a city in fahrenheit degrees is input through
the keyboard.Write a program to convert this temperature
into cetigrade degrees.
#include<stdio.h>
#include<conio.h>
main()
{
float tc,tf;
printf(“enter the temp in fahrenheit=”);
scanf(“%f”,&tf);
tc=(tf-32)*0.56
/* 5/9=0.56 */
printf(“tc=%f”,tc)
getch();
}
e) The length and breadth of a rectangle and radius of a circle
are input through the keyboard.Write a program to calculate
the area and perimeter of the rectangle, and the area and
circumference of the circle.
#include<stdio.h>
#include<conio.h>
main()
{
float l,b,r,ar,pr,ac,cc;
Clrscr();
printf(“enter the length,breadth and radius of circle
respectively=”);
scanf(“%f %f %f,&l,&b,&r);
ar=l*b;
/*area of rectangle*/
pr=2*(l+b);
/*perimeter of rectangle*/
ac=3.14*r*r;
/*area of a circle */
cc=2*3.14*r;
/*circumstances of circle*/
printf(“area of rectangle=%f”,ar);
printf(“perimeter of rectangle =%f”,pr);
printf(“area of circle=%f”,ac);
printf(“circumference of a circle=%f”,cc);
getch();
}
f) Two numbers are input through the keyboard into two location
C and D.write a program to interchange the contents of C and
D.
#include<stdio.h>
#Include<conio.h>
main()
{
float a,b,c,d;
printf(“enter two values”);
scanf(“%f %f,&a,&b);
c=b;
d=a;
printf(“value of c =%f”,c);
printf(“value of d =%f”,d);
getch();
}
g) If a five digit number is input through a keyboard ,write
a program to calculate thesum of its digits.(usethe modulus
operator’%’).
#include<stdio.h>
#include<conio.h>
main()
{
int tot,a,b,c,d,e,f,g,h,I,sum;
printf(“enter a five digit number=”);
scanf(“%d”,&tot);
a=tot/1000;
b=tot%1000;
c=b/1000;
d=b%1000;
e=d/100;
f=d%100;
g=f/10;
h=f%10;
i=h/1;
Sum=a+c+e+g+i;
printf(“sum of five digits=%d”,sum);
getch();
}
h) if a five digit number is input through the keyboard,write
a program to reverse a number.
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,d,e,f,g;
printf(“enter the five digit no=”);
scanf(“%d”,&a);
b=a/10000;
c=((a%1000)/1000)*10;
d=((a%1000)/100)*100;
e=((a%100)/10)*1000;
f=(a%10)*1000;
g+b+c+d+e+f;
printf(“reverse number=%d”,g);
}
i) If a four digit number is input through the keyboard,write
a program to obtain the sum of the first and last digit of
this number.
#include<stdio.h>
#include<conio.h>
main()
{
int tot,a,b,c,d,e,f,g,sum;
Clrscr();
printf(“enter a four digit number=”);
scanf(“%d”,&tot);
a=tot/1000;
b=tot%1000;
c=b/100;
d=b%100;
e=d/10;
f=d%10;
g=f/1;
sum=a+g;
printf(“sum of four digits=%d”,sum);
getch();
}
j) In a town, the percentage of men is 52.The percentage of
total literacy is 48.If total percentage of literate men is
35 of the total population,write a program to find the total
number or illiterate men and women if the population of town
is 80,000.
#include<stdio.h>
#include<conio.h>
main()
{
float pop=80000,perm,ptl,plm,plw,pim,piw;
perm=(pop*52)/100;
ptl=(pop*48)/100;
plm=(pop*35)/100;
plw=(pop*13)/100;
pim=perm-plm;
piw=ptl-plw;
printf(“per of illetrate men=%f”,pim);
printf(“per of illetrate women=%f”,piw);
getch();
}
k) A cashier has currency notes of denominations 10,50 and
100.If the amount to be withdrawn is input through the
keyboard in hundreds, find the total number of currency
notes of each denomination the cashier will have to give to
the withdrawer.
#include<stdio.h>
#include<conio.h>
main()
int money,hundred,a,fifty,b,ten;
clrscr();
printf(“enter the money=”);
scanf(“%d”,&money);
hundred=money/100;
a=money/100;
fifty=a/50;
b=a%50;
ten=b/10;
printf(“hundred notes=%d”,hundred);
printf(“fifty notes =%dn”,fifty);
printf(“ten notes=%dn”,ten);
getch();
}
l) If the total selling price of 15 items and the total profit
earned on them is input through keyboard,Write a program to
find the cost price of one item.
#include<stdio.h>
#include<conio.h>
main()
float sp,pf,total,cp1
Clrscr();
printf(“enter the selling price and profit earned of 15
items=”);
scanf(“%f %f”,&sp,&pf);
total=sp+pf;
cp1=(total*6.66)/100;
printf(“cost price of one item=%f”,cp1);
getch();
}
m) If a five digit number is input through the keyboard,write
a program to print a new number by adding one to each of its
digits.for example if the number that is input is 12391 then
the output should be displayed as 23502
#include<stdio.h>
#include<conio.h>
main()
{
int tot,a,b,c,d,e,f,g,h,I,j,k,l,m,n,reverse;
clrscr();
printf(“enter a five digit number=”);
scanf(“%d”,&tot);
a=tot/10000;
b=a*10000+10000;
c=tot%10000;
d=c/1000;
e=d*1000+1000;
f=c%1000;
g=f/100;
h=g*100+100;
i=f%100;
j=i/10;
k=j*10+10
l=i%10;
m=l/1;
n=m*1+1;
reverse=b+e+h+k+n;
printf(“sum of five digits=%d”,reverse);
getch();
}

Recomendados

Let us c(by yashwant kanetkar) chapter 2 solution por
Let us c(by yashwant kanetkar) chapter 2 solutionLet us c(by yashwant kanetkar) chapter 2 solution
Let us c(by yashwant kanetkar) chapter 2 solutionrohit kumar
43K vistas27 diapositivas
Let us C (by yashvant Kanetkar) chapter 3 Solution por
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 SolutionHazrat Bilal
28.3K vistas14 diapositivas
Let us c chapter 4 solution por
Let us c chapter 4 solutionLet us c chapter 4 solution
Let us c chapter 4 solutionrohit kumar
14.4K vistas4 diapositivas
Let us c(by Yashwant Kanetkar) 5th edition solution chapter 1 por
Let us c(by Yashwant Kanetkar) 5th edition solution chapter 1Let us c(by Yashwant Kanetkar) 5th edition solution chapter 1
Let us c(by Yashwant Kanetkar) 5th edition solution chapter 1rohit kumar
50.8K vistas16 diapositivas
Chapter 8 c solution por
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solutionAzhar Javed
9.1K vistas87 diapositivas
LET US C (5th EDITION) CHAPTER 2 ANSWERS por
LET US C (5th EDITION) CHAPTER 2 ANSWERSLET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSKavyaSharma65
574 vistas22 diapositivas

Más contenido relacionado

La actualidad más candente

Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution por
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solutionLet us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solutionHazrat Bilal
4.4K vistas27 diapositivas
Chapter 3 : Balagurusamy Programming ANSI in C por
Chapter 3 : Balagurusamy Programming ANSI in C Chapter 3 : Balagurusamy Programming ANSI in C
Chapter 3 : Balagurusamy Programming ANSI in C BUBT
14K vistas13 diapositivas
c++ lab manual por
c++ lab manualc++ lab manual
c++ lab manualShrunkhala Wankhede
12.2K vistas74 diapositivas
Chapter 2 : Balagurusamy_ Programming ANsI in C por
Chapter 2 :  Balagurusamy_ Programming ANsI in CChapter 2 :  Balagurusamy_ Programming ANsI in C
Chapter 2 : Balagurusamy_ Programming ANsI in CBUBT
5.5K vistas14 diapositivas
Object Oriented Programming Using C++ Practical File por
Object Oriented Programming Using C++ Practical FileObject Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical FileHarjinder Singh
14.9K vistas130 diapositivas
Input Output Management In C Programming por
Input Output Management In C ProgrammingInput Output Management In C Programming
Input Output Management In C ProgrammingKamal Acharya
3.9K vistas17 diapositivas

La actualidad más candente(20)

Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution por Hazrat Bilal
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solutionLet us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Hazrat Bilal4.4K vistas
Chapter 3 : Balagurusamy Programming ANSI in C por BUBT
Chapter 3 : Balagurusamy Programming ANSI in C Chapter 3 : Balagurusamy Programming ANSI in C
Chapter 3 : Balagurusamy Programming ANSI in C
BUBT14K vistas
Chapter 2 : Balagurusamy_ Programming ANsI in C por BUBT
Chapter 2 :  Balagurusamy_ Programming ANsI in CChapter 2 :  Balagurusamy_ Programming ANsI in C
Chapter 2 : Balagurusamy_ Programming ANsI in C
BUBT5.5K vistas
Object Oriented Programming Using C++ Practical File por Harjinder Singh
Object Oriented Programming Using C++ Practical FileObject Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical File
Harjinder Singh14.9K vistas
Input Output Management In C Programming por Kamal Acharya
Input Output Management In C ProgrammingInput Output Management In C Programming
Input Output Management In C Programming
Kamal Acharya3.9K vistas
Programming in c por vineet4523
Programming in cProgramming in c
Programming in c
vineet4523830 vistas
RECURSION IN C por v_jk
RECURSION IN C RECURSION IN C
RECURSION IN C
v_jk14K vistas
Expression and Operartor In C Programming por Kamal Acharya
Expression and Operartor In C Programming Expression and Operartor In C Programming
Expression and Operartor In C Programming
Kamal Acharya4.1K vistas
Array Of Pointers por Sharad Dubey
Array Of PointersArray Of Pointers
Array Of Pointers
Sharad Dubey2.6K vistas
C programming Lab 1 por Zaibi Gondal
C programming Lab 1C programming Lab 1
C programming Lab 1
Zaibi Gondal4.2K vistas
LET US C (5th EDITION) CHAPTER 1 ANSWERS por KavyaSharma65
LET US C (5th EDITION) CHAPTER 1 ANSWERSLET US C (5th EDITION) CHAPTER 1 ANSWERS
LET US C (5th EDITION) CHAPTER 1 ANSWERS
KavyaSharma65502 vistas
Call by value por Dharani G
Call by valueCall by value
Call by value
Dharani G8.7K vistas
Chapter 6 Balagurusamy Programming ANSI in c por BUBT
Chapter 6  Balagurusamy Programming ANSI  in cChapter 6  Balagurusamy Programming ANSI  in c
Chapter 6 Balagurusamy Programming ANSI in c
BUBT8.5K vistas
Printing different pyramid patterns of numbers,alphabets and stars using C. por Hazrat Bilal
Printing different pyramid patterns of numbers,alphabets and stars using C.Printing different pyramid patterns of numbers,alphabets and stars using C.
Printing different pyramid patterns of numbers,alphabets and stars using C.
Hazrat Bilal1.8K vistas
Type casting in c programming por Rumman Ansari
Type casting in c programmingType casting in c programming
Type casting in c programming
Rumman Ansari4.4K vistas
Basics of c++ Programming Language por Ahmad Idrees
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
Ahmad Idrees47.8K vistas
C programming Lab 2 por Zaibi Gondal
C programming Lab 2C programming Lab 2
C programming Lab 2
Zaibi Gondal4.7K vistas

Similar a Let us c (by yashvant kanetkar) chapter 1 solution

Revision1 C programming por
Revision1 C programmingRevision1 C programming
Revision1 C programmingKho コー。イエー。イエン
2.4K vistas12 diapositivas
Assignment por
AssignmentAssignment
AssignmentMrunalMehta4
97 vistas5 diapositivas
C Programming Interview Questions por
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview QuestionsGradeup
1.3K vistas21 diapositivas
Model question paper_mc0061 por
Model question paper_mc0061Model question paper_mc0061
Model question paper_mc0061gurbaxrawat
367 vistas14 diapositivas
MATLAB Questions and Answers.pdf por
MATLAB Questions and Answers.pdfMATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdfahmed8651
172 vistas42 diapositivas
Unit i intro-operators por
Unit   i intro-operatorsUnit   i intro-operators
Unit i intro-operatorsHINAPARVEENAlXC
44 vistas26 diapositivas

Similar a Let us c (by yashvant kanetkar) chapter 1 solution(20)

C Programming Interview Questions por Gradeup
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview Questions
Gradeup1.3K vistas
Model question paper_mc0061 por gurbaxrawat
Model question paper_mc0061Model question paper_mc0061
Model question paper_mc0061
gurbaxrawat367 vistas
MATLAB Questions and Answers.pdf por ahmed8651
MATLAB Questions and Answers.pdfMATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdf
ahmed8651172 vistas
C and data structure por prabhatjon
C and data structureC and data structure
C and data structure
prabhatjon27.1K vistas
Assignment week0 c++ por Netaji Gandi
Assignment  week0 c++Assignment  week0 c++
Assignment week0 c++
Netaji Gandi284 vistas
(Www.entrance exam.net)-tcs placement sample paper 2 por Pamidimukkala Sivani
(Www.entrance exam.net)-tcs placement sample paper 2(Www.entrance exam.net)-tcs placement sample paper 2
(Www.entrance exam.net)-tcs placement sample paper 2
Pamidimukkala Sivani1.8K vistas
C cheat sheet for varsity (extreme edition) por Saifur Rahman
C cheat sheet for varsity (extreme edition)C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)
Saifur Rahman854 vistas
Ramco Sample Paper 2003 por ncct
Ramco  Sample  Paper 2003Ramco  Sample  Paper 2003
Ramco Sample Paper 2003
ncct558 vistas
Ee693 sept2014midsem por Gopi Saiteja
Ee693 sept2014midsemEe693 sept2014midsem
Ee693 sept2014midsem
Gopi Saiteja365 vistas
LDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdf por Vedant Gavhane
LDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdfLDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdf
LDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdf
Vedant Gavhane4 vistas
Amcat placement questions por m4maths
Amcat placement questionsAmcat placement questions
Amcat placement questions
m4maths11.3K vistas
DAC CCAT GUESS PAPER Jun-Jul 2013 por prabhatjon
DAC CCAT GUESS PAPER Jun-Jul 2013 DAC CCAT GUESS PAPER Jun-Jul 2013
DAC CCAT GUESS PAPER Jun-Jul 2013
prabhatjon27.9K vistas

Último

Generic or specific? Making sensible software design decisions por
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
6 vistas60 diapositivas
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... por
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Donato Onofri
825 vistas34 diapositivas
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko... por
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...Deltares
14 vistas23 diapositivas
SAP FOR CONTRACT MANUFACTURING.pdf por
SAP FOR CONTRACT MANUFACTURING.pdfSAP FOR CONTRACT MANUFACTURING.pdf
SAP FOR CONTRACT MANUFACTURING.pdfVirendra Rai, PMP
13 vistas2 diapositivas
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx por
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptxanimuscrm
14 vistas19 diapositivas
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action por
Gen Apps on Google Cloud PaLM2 and Codey APIs in ActionGen Apps on Google Cloud PaLM2 and Codey APIs in Action
Gen Apps on Google Cloud PaLM2 and Codey APIs in ActionMárton Kodok
5 vistas55 diapositivas

Último(20)

Generic or specific? Making sensible software design decisions por Bert Jan Schrijver
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... por Donato Onofri
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Donato Onofri825 vistas
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko... por Deltares
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
Deltares14 vistas
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx por animuscrm
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
animuscrm14 vistas
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action por Márton Kodok
Gen Apps on Google Cloud PaLM2 and Codey APIs in ActionGen Apps on Google Cloud PaLM2 and Codey APIs in Action
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action
Márton Kodok5 vistas
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI... por Marc Müller
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Marc Müller37 vistas
DSD-INT 2023 Exploring flash flood hazard reduction in arid regions using a h... por Deltares
DSD-INT 2023 Exploring flash flood hazard reduction in arid regions using a h...DSD-INT 2023 Exploring flash flood hazard reduction in arid regions using a h...
DSD-INT 2023 Exploring flash flood hazard reduction in arid regions using a h...
Deltares5 vistas
Ports-and-Adapters Architecture for Embedded HMI por Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert6 vistas
DSD-INT 2023 European Digital Twin Ocean and Delft3D FM - Dols por Deltares
DSD-INT 2023 European Digital Twin Ocean and Delft3D FM - DolsDSD-INT 2023 European Digital Twin Ocean and Delft3D FM - Dols
DSD-INT 2023 European Digital Twin Ocean and Delft3D FM - Dols
Deltares7 vistas
FIMA 2023 Neo4j & FS - Entity Resolution.pptx por Neo4j
FIMA 2023 Neo4j & FS - Entity Resolution.pptxFIMA 2023 Neo4j & FS - Entity Resolution.pptx
FIMA 2023 Neo4j & FS - Entity Resolution.pptx
Neo4j7 vistas
Headless JS UG Presentation.pptx por Jack Spektor
Headless JS UG Presentation.pptxHeadless JS UG Presentation.pptx
Headless JS UG Presentation.pptx
Jack Spektor7 vistas
Dapr Unleashed: Accelerating Microservice Development por Miroslav Janeski
Dapr Unleashed: Accelerating Microservice DevelopmentDapr Unleashed: Accelerating Microservice Development
Dapr Unleashed: Accelerating Microservice Development
Miroslav Janeski10 vistas
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated... por TomHalpin9
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
TomHalpin96 vistas
Advanced API Mocking Techniques por Dimpy Adhikary
Advanced API Mocking TechniquesAdvanced API Mocking Techniques
Advanced API Mocking Techniques
Dimpy Adhikary19 vistas
Airline Booking Software por SharmiMehta
Airline Booking SoftwareAirline Booking Software
Airline Booking Software
SharmiMehta6 vistas

Let us c (by yashvant kanetkar) chapter 1 solution

  • 1. Let us C (by yashvant Kanetkar) chapter 1 Solution Written by Hazrat Bilal(student at AWKUM) & Muhammad Ishfaq Khan(student at AWKUM) Revised by Maimoona Jahanzeb Khattak(student at AWKUM)
  • 2. A. Which of the following are invalid variables name and why? 1) BASICSALARY It is a valid variable. 2) _basic It is a valid variable. 3) basic-hra Hypen is not valid between two words. 4) #MEAN # is invalid in the name of variable. 5) group. Full stop is not applicable in the name of variable. 6) 422 Variable name is the combination of letters and digits, not only digits. 7) population in 2006 There is the gap between the words ,there should not be any gap. 8) over time Mistake of a gap 9) mindovermatter It is a valid variable 10) FLOAT Valid variable 11) hELLO It is a valid variable 12) queue. Mistake of a full stop 13) team’svictory  ‘ is not applicable in the name of variable. 14) Plot # 3 Mistake of a gap. 15) 2015_DDay Variable starts with digit is not aplicabble. B. Point out the errors,if any, in the following C statement: a) Int=314.562*150; Intis a variable name of integer but the value of integer is not integer ,its basically float. b) name=`Ajay’; Name is a character variableso in between there should only one letter or digit or special symbol, and inverted comma is not like that. c) Varchar=`3’;
  • 3. Mistake of inverted comma. d) 3.14*r*r*h=vol_of_cyl; Variable name must be on left side. e) k=(a*b)(c+(2.5a+b)(d+e); k-(a*b)*(c*+(2.5*a+b)*(d+e); f) m_inst=rate of interest*amount in rs; Wrong becauseof gap between variable name. g) si=principal*rateofinterset*numberofyears/100; Proper formatis: (principal*rateofinterest*numberofyears)/100; h) area=3.14*r**2; There is no meaning of** in C . i) volume=3.14*r^2*h; There is no meaning of r^2 in C. j) k=((a*b)+c)(2.5*a+b); K=(a*b)+c)*(2.5*a+b); k) a=b=3=4; Proper format:(a=3 or a=4)or (b=3 or b=4). l) count=count+1; Valid. m) date=’2 mar 04’; Space between variable is not variable and character is of only one letter,digit or special symbol. C. Evaluate the following expressions and show their hierarchy. a) g=big/2+big*4/big-big+abc/3; (abc=2.5,big=2,assumeg to be a float) g=2/2+2*4/2-2+2.5/3; g=1+2*4/2-2+0.8 g=1+4-2+0.8 g=3.8 b) on=ink*act/2+3/2*act+2+tig; (ink=4,act=1,tig=3.2,assumeon to be an int) on=4*1/2+3/2*1+2+3.2; on=2+1.5+2+3.2 on=8.7 (but on integer variable its value will be 8) c) s=qui*add/4-6/2+2/3*6/god; (qui=4,add=2,god=2,assumes to be an int
  • 4. s=4*2/4-6/2+2/3*6/3; s=8/4-6/2+0.6*3 s=2-3+0 s=-1 d) S=1/3*a/4-6/2+2/3*6/g; (a=4,g=3,assumes to be an int) S=1/3*4/4-6/2+2/3*6/2; S=0*4/4-3+0*6/3; S=-3 D. Fill the following table for the expressions given below and then evaluate the result.A sample entry has been filled in the table for expression(a). operator left right remark / 10 5 or 5/2/1 Left operand is unambigous, right is not .. .. .. .. a) g=10/5/2/1;  =2/2/1 =1/1 =1 b) b=3/2+5*4/3;  =1+20/3 =1+6 =7 c) a=b=c=3+4; a=b=c=7 E.Convert the following equations into corresponding C statements.
  • 5. a)Z=8.8(a+b)2/c-0.5+2a/(q+r) (a+b)*(1/m) = 8.8*(a+b)*2/c-0.5+2*/(q+r)/((a+B)*(1/m)). b)X= -b+(b*b)+2 4ac 2a =(-b+(b*b)+2*4*a*c)/2*a. c) R= 2v+6.22(c+d) g+v =(2*v+6.22*(c+d))/g+v. d) A= 7.7b(xy+a)/c-0.8+2b (x+a)(1/y) =(7.7*b*(x*y+a)/c-0.8+2*b)/((x+a)*(1/y)). F.What would be the output of following programs? a) main() { int i=2,j=3,k,l; float a,b; k=i/j*j; l=j/i*i; a=i/j*j; b=j/i*i; printf(“%d %d %f %f”,k,l,a,b); } Output: O 2 0.000 2.000 b) main() { inta,b;
  • 6. a=-3- -3; b=-3- -(-3); printf(“a=%d b=%d”,a,b); } Output: Error. c) main() { int a=5,b=2; int c; c=a%b; printf(“%d”,c); } Output: 1 d) main() { printf(“nnnn nnn”); printf(“nn/n/n nn/n”); } Output: nn nn Nn /n/n nn/n e) main() {
  • 7. int a,b; printf(“enter values of a and b”); scanf(“%d %d”,&a,&b); printf(“a=%d b=%d”,a,b); } Output: Enter values of a and b 34 23 a=34 b=23 f) main() { int p,q printf(“enter values of p and q”); scanf(“%d%d”,p,q); printf(“p=%d q=%d”,p,q) Output: Enter values of p and q 23 34 p=23 q=34 G.Pick up the correct alternative for each of the following questions: a) C language has been developed by 1. Ken Thompson 2. Dennis Ritchie√ 3. Peter Norton 4. Martin Ritchards b) C can be use on 1. Only MS-DOS operating system 2. Only Linux operating system 3. Only windows operating system 4. All the above√
  • 8. c) 1. C programs are converted into machine language with the of An editor help 2. A compiler√ 3. An operating systmem 4. None of the above d) 1. The real constant in C can be expressed on which of following forms Fractional form only the 2. Exponential form only 3. ASCII form only 4. Both fractional and exponential forms√ e) 1. A character variable can at a time store 1 character √ 2. 8 characters 3. 254 characters 4. None of above f) 1. The statement char ch=’Z’ would store in ch The character Z √ 2. ASCII value of Z 3. Z along with the single inverted commas 4. Both (1) ans (2) g) 1. Which of the following is not a character constant ‘Thank You’ 2. ‘Enter values of P,N,R 3. ‘23.56E-03’ 4. All the above √ h) 1. The maximum value that an integer constant can have -32767 is 2. 32767 √ 3. 1.7014e+38 4. -1.7014e+38
  • 9. i) A C variable cannot start with 1. An alphabet 2. A number 3. A special symbol other than underscore 4. Both (2)&(3) above √ j) Which of the following statement is wrong 1. mes=123.56; 2. con=’T’*’A’; 3. this=’T’*20; 4. 3+a=b; √ k) Which of the following shows the correct hierarchy of arithmetic operators in C 1. **,*or/,+or- 2. **,*,/,+,- 3. **,/,*,+,- 4. /or*,-or+ √ l) In b=6.6/a+2*n;which operation will be performed first? 1. 6.6/a √ 2. a+2 3. 2*n 4. Depends upon compiler m) Which of the following is allowd in a C arithmetic instruction? 1. [] 2. {} 3. () √ 4. None of the above n) Which of the following statement is false 1. Each new C instruction has to be written on separate line√ 2. Usually all C statements are in small case letters 3. Blank spaces may be inserted between two words in a C statement 4. Blank spaces cannot be inserted within a variable name
  • 10. o) If a is an integer variable, a=5/2; will return a value 1. 2.5 2. 3 3. 2 4. 0 √ p) The expression,a=7/22*(3.14+2)*3/5;evaluates to 1. 8.28 2. 6.28 3. 3.14 4. 0 √ q) The expression ,a=30*1000+2768;evaluates to 1. 32768 √ 2. -32768 3. 113040 4. 0 r) The expression x=4+2%-8 evaluates to 1. -6 2. 6 √ 3. 4 4. None of the above s) Hierarchy decides which operator 1. Is most important 2. Is used first√ 3. Is fastest 4. Operates on largest numbers t) An integer constant in C must have 1. At least one digit √ 2. At least one decimal point 3. A comma along with digits 4. Digits separated by commas
  • 11. u) 1. A character variable can never store more 32 characters than 2. 8 characters 3. 254 characters 4. 1 character √ v) 1. In C a variable cannot contain Blank spaces 2. Hyphen 3. Decimal point 4. All the above √ w) Which of the following is false in C 1. Keywords can be used as variable names√ 2. Variable names can contain a digit 3. Variable names donot contain a blank space 4. Capital letters can be used in variable names. x) In C, arithmetic instruction cannot contain 1. Variables 2. Constants 3. Variable names on right side of= √ 4. Constants on left side of= y) Which of the following shows the correct hierarchy of arithmetic operations in C 1. /+*- 2. *-/+ 3. +-/* 4. */+-√ z) What will be the value ofd if d is a float afterthe operation d=2/7.0? 1. 0 2. 0.2857 3. Cannot be determined 4. None of the above
  • 12. H. Write C programs for the following. a) Ramesh’s basic salary is input through the keyboard.his dearness allowance is 40% of basic salary,and house rent allowance is 20% of basic salary.Write a program to clculate his gross salary. #include<stdio.h> #include<conio.h> main() { float bs,da,hra,gs; Clrscr(); printf(“enter the Ramesh’s basic salary=”); scanf(“%f”,&bs); da=(bs*40)/100; printf(“dearness allowance=%f”,da); hra=(bs*20)/100; printf(“house rent allowance=%f”,hra); gs=bs-(da+hra); printf(“ramesh’s gross salary=%fn”,gs); getch(); } b) The distance between two cities(in km)is input through the keyboard.write a program to convert and print this distance in meters,feet,inches and centimeters. #include<stdio.h> #include<conio.h> main() { float distance,m,ft,in,cm; Clrscr(); printf(“Enter the distance between two cities in km=”);
  • 13. scanf(“%f”,&distance); m=distance*1000; printf(“m=%f”,m); ft=distance*1000*3.25; printf(“ft=%f”,ft); in=distance*1000*3.25*12; printf(“in=%f”in); cm=distance*1000*3.25*12*2.5; printf(“cm=%f”,cm); getch(); } c) If the marks obtainedby a studentin five different subjects are inputthrough thekeyboard , find outthe aggregatemarks and percentage marks obtained by the student. Assume that the maximum marks that can be obtained by a student in each subject is 100. #include<stdio.h> #include<conio.h> main() { float P1,P2,P3,P3,P4,P5,sum,per,total=500; clrscr(); printf(“enter the marks of 5 subjects=”); scanf(“%f %f %f %f %f”,&P1,&P2,&P3,&P4,&P5); sum=P1+P2+P3+P4+P5; per=(sum*100)/500; printf(“aggregate marks=%fn”,sum); printf(“percentage marks=%fn”,per); getch(); } d) Temperature of a city in fahrenheit degrees is input through the keyboard.Write a program to convert this temperature into cetigrade degrees.
  • 14. #include<stdio.h> #include<conio.h> main() { float tc,tf; printf(“enter the temp in fahrenheit=”); scanf(“%f”,&tf); tc=(tf-32)*0.56 /* 5/9=0.56 */ printf(“tc=%f”,tc) getch(); } e) The length and breadth of a rectangle and radius of a circle are input through the keyboard.Write a program to calculate the area and perimeter of the rectangle, and the area and circumference of the circle. #include<stdio.h> #include<conio.h> main() { float l,b,r,ar,pr,ac,cc; Clrscr(); printf(“enter the length,breadth and radius of circle respectively=”); scanf(“%f %f %f,&l,&b,&r); ar=l*b; /*area of rectangle*/ pr=2*(l+b); /*perimeter of rectangle*/ ac=3.14*r*r; /*area of a circle */ cc=2*3.14*r; /*circumstances of circle*/ printf(“area of rectangle=%f”,ar);
  • 15. printf(“perimeter of rectangle =%f”,pr); printf(“area of circle=%f”,ac); printf(“circumference of a circle=%f”,cc); getch(); } f) Two numbers are input through the keyboard into two location C and D.write a program to interchange the contents of C and D. #include<stdio.h> #Include<conio.h> main() { float a,b,c,d; printf(“enter two values”); scanf(“%f %f,&a,&b); c=b; d=a; printf(“value of c =%f”,c); printf(“value of d =%f”,d); getch(); } g) If a five digit number is input through a keyboard ,write a program to calculate thesum of its digits.(usethe modulus operator’%’). #include<stdio.h> #include<conio.h> main() { int tot,a,b,c,d,e,f,g,h,I,sum; printf(“enter a five digit number=”); scanf(“%d”,&tot); a=tot/1000; b=tot%1000;
  • 16. c=b/1000; d=b%1000; e=d/100; f=d%100; g=f/10; h=f%10; i=h/1; Sum=a+c+e+g+i; printf(“sum of five digits=%d”,sum); getch(); } h) if a five digit number is input through the keyboard,write a program to reverse a number. #include<stdio.h> #include<conio.h> main() { int a,b,c,d,e,f,g; printf(“enter the five digit no=”); scanf(“%d”,&a); b=a/10000; c=((a%1000)/1000)*10; d=((a%1000)/100)*100; e=((a%100)/10)*1000; f=(a%10)*1000; g+b+c+d+e+f; printf(“reverse number=%d”,g); } i) If a four digit number is input through the keyboard,write a program to obtain the sum of the first and last digit of this number.
  • 17. #include<stdio.h> #include<conio.h> main() { int tot,a,b,c,d,e,f,g,sum; Clrscr(); printf(“enter a four digit number=”); scanf(“%d”,&tot); a=tot/1000; b=tot%1000; c=b/100; d=b%100; e=d/10; f=d%10; g=f/1; sum=a+g; printf(“sum of four digits=%d”,sum); getch(); } j) In a town, the percentage of men is 52.The percentage of total literacy is 48.If total percentage of literate men is 35 of the total population,write a program to find the total number or illiterate men and women if the population of town is 80,000. #include<stdio.h> #include<conio.h> main() { float pop=80000,perm,ptl,plm,plw,pim,piw; perm=(pop*52)/100; ptl=(pop*48)/100; plm=(pop*35)/100; plw=(pop*13)/100; pim=perm-plm; piw=ptl-plw;
  • 18. printf(“per of illetrate men=%f”,pim); printf(“per of illetrate women=%f”,piw); getch(); } k) A cashier has currency notes of denominations 10,50 and 100.If the amount to be withdrawn is input through the keyboard in hundreds, find the total number of currency notes of each denomination the cashier will have to give to the withdrawer. #include<stdio.h> #include<conio.h> main() int money,hundred,a,fifty,b,ten; clrscr(); printf(“enter the money=”); scanf(“%d”,&money); hundred=money/100; a=money/100; fifty=a/50; b=a%50; ten=b/10; printf(“hundred notes=%d”,hundred); printf(“fifty notes =%dn”,fifty); printf(“ten notes=%dn”,ten); getch(); } l) If the total selling price of 15 items and the total profit earned on them is input through keyboard,Write a program to find the cost price of one item. #include<stdio.h> #include<conio.h> main() float sp,pf,total,cp1
  • 19. Clrscr(); printf(“enter the selling price and profit earned of 15 items=”); scanf(“%f %f”,&sp,&pf); total=sp+pf; cp1=(total*6.66)/100; printf(“cost price of one item=%f”,cp1); getch(); } m) If a five digit number is input through the keyboard,write a program to print a new number by adding one to each of its digits.for example if the number that is input is 12391 then the output should be displayed as 23502 #include<stdio.h> #include<conio.h> main() { int tot,a,b,c,d,e,f,g,h,I,j,k,l,m,n,reverse; clrscr(); printf(“enter a five digit number=”); scanf(“%d”,&tot); a=tot/10000; b=a*10000+10000; c=tot%10000; d=c/1000; e=d*1000+1000; f=c%1000; g=f/100; h=g*100+100; i=f%100; j=i/10; k=j*10+10 l=i%10; m=l/1; n=m*1+1; reverse=b+e+h+k+n;
  • 20. printf(“sum of five digits=%d”,reverse); getch(); }