Let us C (by yashvant Kanetkar) chapter 3 SolutionHazrat Bilal
Â
All rights reserved. No part of this slide
may be reproduced, stored in a retrieval
system, or transmitted, in any form or by
any means, without the prior permission.
let us c(by yashwantkanetkar) solution chapter 4 solution 5th edition
Note:- I am not an expert. I am Engineering student. So my answer may have error or mistake
Let us C (by yashvant Kanetkar) chapter 3 SolutionHazrat Bilal
Â
All rights reserved. No part of this slide
may be reproduced, stored in a retrieval
system, or transmitted, in any form or by
any means, without the prior permission.
let us c(by yashwantkanetkar) solution chapter 4 solution 5th edition
Note:- I am not an expert. I am Engineering student. So my answer may have error or mistake
Sometimes you see code that is perfectly OK according to the definition of the language, but which is flawed because it breaks too many established idioms and conventions. On the other hand, a solid piece of code is something that looks like it is written by an experienced person who cares about professionalism in programming.
A presentation at Norwegian Developer Conference 2010
Programs are complete in best of my knowledge with zero compilation error in IDE Bloodshed Dev-C++. These can be easily portable to any versions of Visual Studio or Qt. If you need any guidance please let me know via comments and Always Enjoy Programming.
A quick tutorial on what debuggers are and how to use them. We present a debugging example using GDB. At the end of this tutorial, you will be able to work your way through a crash and analyze the cause of the error responsible for the crash.
Sometimes you see code that is perfectly OK according to the definition of the language, but which is flawed because it breaks too many established idioms and conventions. On the other hand, a solid piece of code is something that looks like it is written by an experienced person who cares about professionalism in programming.
A presentation at Norwegian Developer Conference 2010
Programs are complete in best of my knowledge with zero compilation error in IDE Bloodshed Dev-C++. These can be easily portable to any versions of Visual Studio or Qt. If you need any guidance please let me know via comments and Always Enjoy Programming.
A quick tutorial on what debuggers are and how to use them. We present a debugging example using GDB. At the end of this tutorial, you will be able to work your way through a crash and analyze the cause of the error responsible for the crash.
Business communication in Chinese culture
When talking, maintain good posture and a quiet voice. Some Chinese will look others in the eyes, while some will not. Lowering the eyes is considered a sign of respect; direct eye contact may be considered too personal or even rude. The Chinese generally do not like being touched by strangers. Chinese are typically modest; in China one should always exhibit a humble spirit and never boast or exaggerate oneâs abilities. The Chinese believe humility to be a virtue; they will also investigate oneâs claims. Excessive hand gestures and facial expressions while communicating are not common.âĸ Chinese business negotiations nevertheless continue to be heavily influenced by the peoplecentric
âĸ philosophies of Confucius and Lao Tzu, and their core values of collectivism, honor, respect,
âĸ obedience, and harmonious relationships. Chinaâs unique guo qing adds another layer of complexity
âĸ to negotiating behavior by shaping the decision-making process politically and setting the tone for
âĸ doing business with foreigners. The western business practices admitted through Chinaâs open doorhave paved the way for smoother communication during business negotiations, albeit sometimes constrained by conflicting concepts or values.
Ex.1 Write a program to print the following pattern
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Ex.2 Write a program to find bigger of three integers.
Ex.3 Write a program to calculate GCD between two numbers.
Ex.4 Write a program to find transpose of matrix.
Ex.5 Write a program which deletes an element from an array & display all other elements.
Ex.6 Write a program to calculate XA+YB where A & B are matrix & X=2, Y=3.
Ex.7 Write a program to calculate the total amount of money in the piggy bank, given that coins of Rs.10, Rs.5, Rs.2, RS.1.
& many more.....
This document contains some programs of C using Data structures, like Stack, LinkedList, queue, Fibonacci series, addition and multiplication of two matrices,etc.
These problems are so common that you will find in any C learning curriculum. Either in your college or in any IT institute.
I have provided solutions to these problems as well.
Happy learning...
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Â
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Â
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Â
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
âĸ The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
âĸ The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate âany matterâ at âany timeâ under House Rule X.
âĸ The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
Â
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasnât one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
Â
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Unit 8 - Information and Communication Technology (Paper I).pdf
Â
C Programming Exam problems & Solution by sazzad hossain
1. Problems and solutions
1.1.1.1. ProgramProgramProgramProgram totototo findfindfindfind outoutoutout thethethethe temperaturetemperaturetemperaturetemperature inininin FahrenheitFahrenheitFahrenheitFahrenheit
#include <stdio.h>
void main()
{
float c, f;
printf("nEnter temperature in degree Centigrade: ");
scanf("%f", &c);
f = (1.8*c) + 32;
printf("n Temperature in degree Fahrenheit: %.2f", f);
getchar();
}
2.2.2.2.ProgramProgramProgramProgram totototo findfindfindfind outoutoutout thethethethe biggerbiggerbiggerbigger numbernumbernumbernumber betweenbetweenbetweenbetween thethethethe
twotwotwotwo numbersnumbersnumbersnumbers
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b;
2. printf("Enter a numbern");
scanf("%d",&a);
printf("Enter a numbern");
scanf("%d",&b);
if(a>b)
{
printf("%d is greater than %dn",a,b);
}
else if(a,b)
{
printf("%d is less than %dn",a,b);
}
else
{
printf("%d is equal to %dn",a,b);
}
getchar();
return 0;
}
3.3.3.3.ProgramProgramProgramProgram totototo findfindfindfind outoutoutout eveneveneveneven andandandand oddoddoddodd number.number.number.number.
#include <stdio.h>
int main()
3. {
int a;
printf("Enter a: n");
scanf("%d", &a);
/* logic */
if (a % 2 == 0)
{printf("The given number is EVENn");
}
else
{printf("The given number is ODDn");
}
return 0;
}
4.4.4.4. ProgramProgramProgramProgram forforforfor squaresquaresquaresquare ofofofof aaaa numbernumbernumbernumber
#include<stdio.h>
#include<conio.h>
void main()
{
long int m,n;
printf("Please enter the number");
scanf("%ld" ,&n);
m=n;
n=n*n;
4. printf("Square of entered number %ld = %ld ",m,n);
}
5.5.5.5. ProgramProgramProgramProgram forforforfor summationsummationsummationsummation ofofofof aaaa seriesseriesseriesseries
NormalNormalNormalNormal series(1+3+series(1+3+series(1+3+series(1+3+âĻâĻâĻâĻ..+n)..+n)..+n)..+n)
#include <stdio.h>
#include <conio.h>
void main()
{
int i, N, sum = 0;
clrscr();
printf("Enter The last number of the series n");
scanf ("%d", &N);
for (i=1; i <= N; i++)
{
sum = sum + i;
}
5. printf ("Sum of first %d natural numbers = %dn", N, sum);
}
WhenWhenWhenWhen differencedifferencedifferencedifference isisisis 2222
#include <stdio.h>
#include <conio.h>
void main()
{
int i, N, sum = 0;
clrscr();
printf("Enter The last number of the series n");
scanf ("%d", &N);
6. for (i=1; i <= N; i=i+2)
{
sum = sum + i;
}
printf ("Sum of the series is = %dn", sum);
}
SquareSquareSquareSquare series(1^2+3^2+series(1^2+3^2+series(1^2+3^2+series(1^2+3^2+âĻâĻâĻâĻ..+n^2)..+n^2)..+n^2)..+n^2)
#include<stdio.h>
int main()
{
int n,i;
int sum=0;
printf("Enter the last number os the n i.e. max values of series: ");
scanf("%d",&n);
sum = (n * (n + 1) * (2 * n + 1 )) / 6;
printf("Sum of the series : ");
for(i =1;i<=n;i++){
if (i != n)
printf("%d^2 + ",i);
else
printf("%d^2 = %d ",i,sum);
7. }
return 0;
}
6.6.6.6. FactorialFactorialFactorialFactorial ofofofof aaaa numbernumbernumbernumber
#include <stdio.h>
int main()
{
int c, n, fact = 1;
printf("n Enter a number to calculate it's factorial: ");
scanf("%d", &n);
for (c = 1; c <= n; c++)
fact = fact * c;
printf("Factorial of %d = %d n", n, fact);
return 0;
}
7.7.7.7. ProgramProgramProgramProgram forforforfor standardstandardstandardstandard deviationdeviationdeviationdeviation ofofofof aaaa numbernumbernumbernumber
#include <stdio.h>
#include <math.h>
float standard_deviation(float data[], int n);
int main()
{
int n, i;
8. float data[100];
printf("Enter number of datas to be calculated to ndetermine the standard deviation( should be
less than 100): ");
scanf("%d",&n);
printf("Enter elements: ");
for(i=0; i<n; ++i)
scanf("%f",&data[i]);
printf("n");
printf("Standard Deviation = %.2f", standard_deviation(data,n));
return 0;
}
float standard_deviation(float data[], int n)
{
float mean=0.0, sum_deviation=0.0;
int i;
for(i=0; i<n;++i)
{
mean+=data[i];
}
mean=mean/n;
for(i=0; i<n;++i)
sum_deviation+=(data[i]-mean)*(data[i]-mean);
return sqrt(sum_deviation/n);
}
9. 8.8.8.8. WhetherWhetherWhetherWhether thethethethe yearyearyearyear isisisis leapleapleapleap yearyearyearyear orororor notnotnotnot
#include <stdio.h>
int main()
{
int year;
printf("n Enter a year to check whether it is a leap year or not: ");
scanf("%d", &year);
if ( year%4 == 0 )
printf("%d is a leap year.n", year);
else
printf("%d is not a leap year.n", year);
return 0;
}
9.9.9.9. WhetherWhetherWhetherWhether aaaa numbernumbernumbernumber isisisis aaaa primeprimeprimeprime numbernumbernumbernumber orororor notnotnotnot
#include<stdio.h>
int main()
{
int n, c = 2;
printf("n Enter a number to check if it is prime: ");
scanf("%d",&n);
for ( c = 2 ; c <= n - 1 ; c++ )
10. {
if ( n%c == 0 )
{
printf("%d is not prime.n", n);
break;
}
}
if ( c == n )
printf("%d is prime.n", n);
return 0;
}
10.10.10.10. TheTheTheThe biggestbiggestbiggestbiggest numbernumbernumbernumber amongamongamongamong threethreethreethree numbersnumbersnumbersnumbers
#include <stdio.h>
int main()
{int a, b, c;
printf("Enter a,b,c: n");
scanf("%d %d %d", &a, &b, &c);
if (a > b && a > c)
{printf("a is the biggest number");}
else if (b > a && b > c)
{printf("b is the biggest number ");}
11. else if (c > a && c > b)
{printf("c is the biggest number ");}
else {printf("all are equal or any two values are equal");}
return 0;
}
11.11.11.11. FibonacciFibonacciFibonacciFibonacci series.series.series.series.
#include<stdio.h>
main()
{
int n, first = 0, second = 1, next, c;
printf("n Enter the number of terms: ");
scanf("%d",&n);
printf("First %d terms of Fibonacci series are :-n",n);
for ( c = 0 ; c < n ; c++ )
{
if ( c <= 1 )
next = c;
else
{
next = first + second;
first = second;
second = next;
12. }
printf("%dn",next);
}
return 0;
}
12.12.12.12. WhetherWhetherWhetherWhether thethethethe twotwotwotwo stringstringstringstring areareareare equalequalequalequal
#include<stdio.h>
#include<string.h>
main()
{
char a[100], b[100];
printf("Enter the first string to be compared: ");
gets(a);
printf("nEnter the second string : ");
gets(b);
if( strcmp(a,b) == 0 )
printf("Entered strings are equal.n");
else
printf("Entered strings are not equal.n");
return 0;
}
13. 13.13.13.13. FindFindFindFind outoutoutout thethethethe lengthlengthlengthlength ofofofof aaaa stringstringstringstring
#include<stdio.h>
#include<string.h>
main()
{
char a[100];
int length;
printf("Enter a string to calculate it's length: ");
gets(a);
length = strlen(a);
printf("Length of entered string is = %dn",length);
return 0;
}
14.14.14.14. WhetherWhetherWhetherWhether aaaa particularparticularparticularparticular charactercharactercharactercharacter existsexistsexistsexists inininin aaaa stringstringstringstring
(frequency):(frequency):(frequency):(frequency):
#include <stdio.h>
int main(){
char c[1000],ch;
int i,count=0;
printf("Enter a string: ");
14. gets(c);
printf("Enter a characeter to find frequency: ");
scanf("%c",&ch);
for(i=0;c[i]!='0';++i)
{
if(ch==c[i])
++count;
}
printf("Frequency of %c = %d", ch, count);
return 0;
}
15.15.15.15. FindFindFindFind outoutoutout thethethethe maximummaximummaximummaximum andandandand minimumminimumminimumminimum numbernumbernumbernumber inininin anananan
arrayarrayarrayarray ::::
[maximum][maximum][maximum][maximum]
#include <stdio.h>
int main()
{
int array[100], maximum, size, c, location = 1;
printf("Enter the number of elements in arrayn");
scanf("%d", &size);
printf("Enter %d integersn", size);
for (c = 0; c < size; c++)
scanf("%d", &array[c]);
15. maximum = array[0];
for (c = 1; c < size; c++)
{
if (array[c] > maximum)
{
maximum = array[c];
location = c+1;
}
}
printf("Maximum element is present at location number %d and it's value is %d.n", location,
maximum);
return 0;
}
[Minimum][Minimum][Minimum][Minimum]
#include <stdio.h>
int main()
{
int array[100], minimum, size, c, location = 1;
printf("Enter the number of elements in arrayn");
scanf("%d",&size);
printf("Enter %d integersn", size);
for ( c = 0 ; c < size ; c++ )
scanf("%d", &array[c]);
minimum = array[0];
for ( c = 1 ; c < size ; c++ )
{
16. if ( array[c] < minimum )
{
minimum = array[c];
location = c+1;
}
}
printf("Minimum element is present at location number %d and it's value is %d.n", location,
minimum);
return 0;
}
16.16.16.16. FindFindFindFind outoutoutout powerpowerpowerpower valuevaluevaluevalue
#include <stdio.h>
int main()
{
int base, exp;
long int value=1;
printf("Enter base number and exponent respectively: ");
scanf("%d%d", &base, &exp);
while (exp!=0)
{
value*=base;
--exp;
17. }
printf("Answer = %d", value);
}
17.17.17.17. ProgramProgramProgramProgram forforforfor salarysalarysalarysalary sheetsheetsheetsheet
#include<stdio.h>
#include<conio.h>
struct employ
{
char name[20];
int id,bp;
float tot,hra,dr;
};
void main()
{
struct employ list[20],temp;
char name[30];
int n,i,j,m;
printf("Enter the number of employees: ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("nEnter the name of employee: ");
19. getchar();
}
18.18.18.18. ProgramProgramProgramProgram forforforfor findfindfindfind thethethethe valuevaluevaluevalue totototo thethethethe followingfollowingfollowingfollowing equationequationequationequation ()()()()
#include<stdio.h>
#include<math.h>
int main(){
float a,b,c;
float d,root1,root2;
printf("Enter a, b and c of quadratic equation: ");
scanf("%f%f%f",&a,&b,&c);
d = b * b - 4 * a * c;
if(d < 0){
printf("Roots are complex number.n");
printf("Roots of quadratic equation are: ");
21. 19.19.19.19. ConversionConversionConversionConversion ofofofof decimaldecimaldecimaldecimal numbernumbernumbernumber totototo binarybinarybinarybinary numbernumbernumbernumber
#include <stdio.h>
int main()
{
int n, c, k;
printf("Enter an integer in decimal number systemn");
scanf("%d", &n);
printf("%d in binary number system is:n", n);
for (c = 31; c >= 0; c--)
{
k = n >> c;
if (k & 1)
printf("1");
else
printf("0");
}
printf("n");
return 0;
}
20.20.20.20. ProgramProgramProgramProgram forforforfor studentsstudentsstudentsstudents gradinggradinggradinggrading usingusingusingusing structurestructurestructurestructure
#include<stdio.h>
24. getch();
}
21.21.21.21. TakeTakeTakeTake somesomesomesome inputinputinputinput andandandand findfindfindfind sumsumsumsum andandandand averageaverageaverageaverage
#include<stdio.h>
#include<conio.h>
void main()
{
int i,sum=0,n,x;
printf("nHow many numbers you want to input? : ",n);
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("nEnter numbers to add: ",x);
scanf("%d",&x);
sum=sum+x;
}
printf("nSum is: %d",sum);
printf("nAverage is: %d",sum/n);
}
22.22.22.22. WriteWriteWriteWrite aaaa programprogramprogramprogram totototo sortsortsortsort somesomesomesome numbersnumbersnumbersnumbers inininin ascendingascendingascendingascending
orderorderorderorder
25. #include <stdio.h>
int main()
{
int n, array[1000], c, d, t;
printf("Enter number of elementsn");
scanf("%d", &n);
printf("Enter %d integersn", n);
for (c = 0; c < n; c++) {
scanf("%d", &array[c]);
}
for (c = 1 ; c <= n - 1; c++) {
d = c;
while ( d > 0 && array[d] < array[d-1]) {
t = array[d];
array[d] = array[d-1];
array[d-1] = t;
d--;
}
}
printf("Sorted list in ascending order:n");
for (c = 0; c <= n - 1; c++) {
printf("%dn", array[c]);
}
return 0;
}
26. 23.23.23.23. WriteWriteWriteWrite aaaa programprogramprogramprogram totototo findfindfindfind totototo reversereversereversereverse stringstringstringstring
#include<stdio.h>
#include<string.h>
main()
{
char arr[100];
printf("n Enter a string to reverse: ");
gets(arr);
strrev(arr);
printf("Reverse of entered string is n%sn",arr);
return 0;
}
24.24.24.24. TakeTakeTakeTake somesomesomesome inputinputinputinput inininin aaaa tabletabletabletable andandandand displaydisplaydisplaydisplay themthemthemthem (two(two(two(two
dimensionaldimensionaldimensionaldimensional array)array)array)array) andandandand add/multiplyadd/multiplyadd/multiplyadd/multiply themthemthemthem
#include<stdio.h>
int main()
{
int matrix1[12][12], matrix2[12][12], sum[12][12],multi[12][12], i, j, m,n,p,q;
printf("Enter the order of first matrix: ");
scanf("%d%d",&m,&n);
printf("Enter the order of second matrix: ");
27. scanf("%d%d",&p,&q);
if(m!=p && n!=q){
printf("Order of matrix did not matched!!");
}
printf("Enter first matrix: n");
for(i = 0 ; i < m; i++){
for(j = 0; j < n; j++)
scanf("%d", &matrix1[i][j]);
}
printf("Enter second matrix: n");
for(i = 0 ; i < p; i++){
for(j = 0; j < q; j++)
scanf("%d", &matrix2[i][j]);
}
for(i = 0 ; i < m; i++){
for(j = 0; j < n; j++)
sum[i][j] = matrix1[i][j] + matrix2[i][j];
}
printf("The sum of the matrix is :n");
for(i = 0 ; i < m; i++){
for(j = 0; j < n; j++){
printf("%d", sum[i][j]);
printf("t");
}
28. printf("n");
}
for(i = 0 ; i < m; i++){
for(j = 0; j < n; j++)
multi[i][j] = matrix1[i][j] * matrix2[i][j];
}
printf("The multiplication of the matrix is :n");
for(i = 0 ; i < m; i++){
for(j = 0; j < n; j++){
printf("%d", multi[i][j]);
printf("t");
}
printf("n");
}
return 0;
}
25.25.25.25. TakeTakeTakeTake inputinputinputinput andandandand findfindfindfind sumsumsumsum usingusingusingusing functionfunctionfunctionfunction
#include<stdio.h>
#include<conio.h>
void sum();
void main()
29. {
sum();
getchar();
}
void sum()
{
int n1,n2,s;
printf("nEnter two numbersn ");
scanf("%d%d",&n1,&n2);
s=n1+n2;
printf("n the sum is %d",s);
}
26.26.26.26. ProgramProgramProgramProgram forforforfor stringstringstringstring compare,compare,compare,compare, copycopycopycopy andandandand additionadditionadditionaddition
[Compare][Compare][Compare][Compare]
#include<stdio.h>
#include<string.h>
main()
{
char a[100], b[100];
printf("Enter the first stringn");
gets(a);
30. printf("Enter the second stringn");
gets(b);
if( strcmp(a,b) == 0 )
printf("Entered strings are equal.n");
else
printf("Entered strings are not equal.n");
return 0;
}
[Copy][Copy][Copy][Copy]
#include<stdio.h>
void copy_string(char*, char*);
main()
{
char source[100], target[100];
printf("Enter source stringn");
gets(source);
copy_string(target, source);
printf("Target string is "%s"n", target);
return 0;
}
void copy_string(char *target, char *source)
{
while(*source)
31. {
*target = *source;
source++;
target++;
}
*target = '0';
}
[Addition][Addition][Addition][Addition]
#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
char a[100], b[100];
printf("Enter the first stringn");
gets(a);
printf("Enter the second stringn");
gets(b);
strcat(a,b);
printf("String obtained on addition is %sn",a);
getchar();
return 0;
}