Вы находитесь на странице: 1из 23

8/25/2017 Chapter 2 - Let Us C Solutions

(/)

(http://rating-widget.com/my-rating-report/star/oxygen/rating-86327220-5/)
Rate this (152 Votes)

[C] Attempt the following:


(a) If cost price and selling price of an item is input through the keyboard, write a program to

determine whether the seller has made profit or incurred loss. Also determine how much

profit he made or loss he incurred.

#include<stdio.h>
#include<conio.h>
main()
{
int cp,sp,l,p; //cp=cost price,sp=selling price,l=loss,p=profit
clrscr();
printf("Enter Cost Price of an item : RS ");
scanf("%d",&cp);
printf("Enter Selling Price of an item : RS ");
scanf("%d",&sp);
if(cp>sp) // Loop for Loss
{
l=cp-sp;
printf("You have made LOSS. Your Loss is RS %d",l);
}
else if(sp>cp) // Loop for Profit
{
p=sp-cp;
printf("You have gain PROFIT. Your Profit is RS %d",p);
}
else if(sp=cp) // Loop for no Loss no Profit
{

http://letuscsolutions.weebly.com/chapter-2.html 1/23
8/25/2017 Chapter 2 - Let Us C Solutions
printf("You have neither Loss nor Profit");
}
getch();
}

(b) Any integer is input through the keyboard. Write a program to find out whether it is an

odd number or even number.

#include<stdio.h>
#include<conio.h>
main()
{
int num; // num=number
clrscr();
printf("Enter any integer to know weather its is Even or Odd : ");
scanf("%d",&num);
if(num%2==0)
{
printf("%d is Even number",num);
}
else
{
printf("%d is Odd number",num);
}
getch();
}

(c) Any year is input through the keyboard. Write a program to determine whether the year is

a leap year or not. (Hint: Use the % (modulus) operator)

#include<stdio.h>
#include<conio.h>
main()
{
int year;
clrscr();
printf("Enter any year : ");
scanf("%d",&year);
if(year%4==0)
printf("%d is a leap year.",year);
else
printf("%d is not a leap year.",year);
getch();
}

(d) According to the Gregorian calendar, it was Monday on the date 01/01/1900. If any year is

input through the keyboard write a program to find out what is the day on 1st January of this

year.

http://letuscsolutions.weebly.com/chapter-2.html 2/23
8/25/2017 Chapter 2 - Let Us C Solutions
Coming Soon...

(e) A five-digit number is entered through the keyboard. Write a program to obtain the

reversed number and to determine whether the original and reversed numbers are equal or

not.

main()
{
int a,b,c,d,e,f,g,i,j;
clrscr();
printf("Enter the five digit number\n");
scanf("%d",&a);
b=a%10;
c=a/10;
d=c%10;
e=c/10;
f=e%10;
g=e/10;
i=g%10;
j=g/10;
printf("The reverse number is %d%d%d%d%d",b,d,f,i,j);
printf("\nThe original and reverse number is not equal");
getch();
}

(f) If the ages of Ram, Shyam and Ajay are input through the keyboard, write a program to

determine the youngest of the three.

main()
{
int ram, shyam, ajay;
clrscr();
printf("Enter ages of Ram, Shayam, Ajay\n");
scanf("%d %d %d", &ram, &shyam, &ajay);
if (ram<shyam)
{
if (ram<ajay)
printf("Ram is younger.");
else
printf("Ajay is younger");
}
else
{
if (shyam<ajay)
printf("Shayam is younger");
else
printf("Ajay is younger");
}

http://letuscsolutions.weebly.com/chapter-2.html 3/23
8/25/2017 Chapter 2 - Let Us C Solutions
getch();
}

(g) Write a program to check whether a triangle is valid or not, when the three angles of the

triangle are entered through the keyboard. A triangle is valid if the sum of all the three

angles is equal to 180 degrees.

#include<stdio.h>
#include<conio.h>
main()
{
float a1,a2,a3,sum; //a1=angle1,a2=angle2,a3=angle3,sum=sum of all angles
clrscr();
printf("Enter three angle of a triangle : ");
scanf("%f%f%f",&a1,&a2,&a3);
sum=a1+a2+a3;
if(sum==180)
{
printf("Triangle is Valid.");
}
else
{
printf("Triangle is invalid.");
}
getch();
}

(h) Find the absolute value of a number entered through the keyboard.

Submitted by Rahul Raina

void main( )
{
int i, j;
printf ("Enter number : ");
scanf ("%d", &i);
if(i<0)
j = -i;
else
j = i;
printf ("%d", j);
getch();
}

(i) Given the length and breadth of a rectangle, write a program to find whether the area of the

rectangle is greater than its perimeter. For example, the area of the rectangle with length =

5 and breadth = 4 is greater than its perimeter

http://letuscsolutions.weebly.com/chapter-2.html 4/23
8/25/2017 Chapter 2 - Let Us C Solutions
#include<stdio.h>
#include<conio.h>
main()
{
int l,b,a,p; // l=length,b=breadth,a=area,p=perimeter of rectangle
clrscr();
printf("Enter Length of a rectangle : ");
scanf("%d",&l);
printf("Enter Breadth of a rectangle : ");
scanf("%d",&b);
p=2*(l+b);
a=l*b;
if(a>p)
{ // "\n" is use for new line
printf("\nYes! Area[%d] is greater that its perimeter[%d]",a,p);
}
else
{
printf("\nNo! Area[%d] is not greater that its perimeter[%d]",a,p);
}
getch();
}

(j) Given three points (x1, y1), (x2, y2) and (x3, y3), write a program to check if all the three

points fall on one straight line.

#include<stdio.h>
#include<conio.h>
main()
{
int x1,y1,x2,y2,x3,y3,m1,m2; // m1=slope 1,m2=slope 2
clrscr();
printf("Enter coordinates of 1st point (x1,y1) : ");
scanf("%d%d",&x1,&y1);
printf("Enter coordinates of 2nd point (x2,y2) : ");
scanf("%d%d",&x2,&y2);
printf("Enter coordinates of 3rd point (x3,y3) : ");
scanf("%d%d",&x3,&y3);
m1=(y2-y1)/(x2-x1);
m2=(y3-y2)/(x3-x2);
if(m1==m2)
{
printf("The given point fall on one straight line.");
}
else
{
printf("The given point does not fall on one straight line.");
}

http://letuscsolutions.weebly.com/chapter-2.html 5/23
8/25/2017 Chapter 2 - Let Us C Solutions
getch();
}

(k) Given the coordinates (x, y) of a center of a circle and its radius, write a program which

will determine whether a point lies inside the circle, on the circle or outside the circle.

(Hint: Use sqrt( ) and pow( ) functions)

Coming Soon...

(l) Given a point (x, y), write a program to find out if it lies on the x-axis, y-axis or at the origin,

viz. (0, 0).

#include<stdio.h>
#include<conio.h>
main()
{
int x,y;
clrscr();
printf("Enter coordinates of a point (x,y) = ");
scanf("%d%d",&x,&y);
if(x==0&&y!=0)
{
printf("The point lies on y axis.");
}
else if(y==0&&x!=0)
{
printf("The point lies on x axis.");
}
else if(x==0&&y==0)
{
printf("The point lies on origin.");
}
getch();
}

[G] Attempt the following:


(a) Any year is entered through the keyboard, write a program to determine whether the year

is leap or not. Use the logical operators && and ||.

#include<stdio.h>
#include<conio.h>
main()
{
int year;
clrscr();
printf("Enter any year : ");
scanf("%d",&year);

http://letuscsolutions.weebly.com/chapter-2.html 6/23
8/25/2017 Chapter 2 - Let Us C Solutions
if((year%4==0&&year%100!=0)||year%400==0)
{
printf("%d is a Leap Year.");
}
else
{
printf("%d is not a Leap Year.");
}
getch();
}

(b) Any character is entered through the keyboard, write a program to determine whether the

character entered is a capital letter, a small case letter, a digit or a special symbol. The

following table shows the range of ASCII values for various characters. Characters ASCII

Values for various characters.

#include<stdio.h>
#include<conio.h>
main()
{
char a;
clrscr();
printf("Enter any single letter, digit or special symbol : ");
scanf("%c",&a);
if(a>=65&&a<=90)
{
printf("You entered a CAPITAL LETTER.\n");
}
if(a>=97&&a<=122)
{
printf("You entered a SMALL LETTER.\n");
}
if(a>=48&&a<=57)
{
printf("You entered a DIGIT.\n");
}
if((a>=0&&a<=47)||(a>=58&&a<=64)||(a>=91&&a<=96)||(a>=123&&a<=127))

http://letuscsolutions.weebly.com/chapter-2.html 7/23
8/25/2017 Chapter 2 - Let Us C Solutions
{
printf("You entered an SPECIAL SYMBOL.\n");
}
getch();
}

(c) A certain grade of steel is graded according to the following conditions:

(i) Hardness must be greater than 50

(ii) Carbon content must be less than 0.7

(iii) Tensile strength must be greater than 5600

The grades are as follows:

Grade is 10 if all three conditions are met

Grade is 9 if conditions (i) and (ii) are met

Grade is 8 if conditions (ii) and (iii) are met

Grade is 7 if conditions (i) and (iii) are met

Grade is 6 if only one condition is met

Grade is 5 if none of the conditions are met

Write a program, which will require the user to give values of hardness, carbon content and

tensile strength of the steel under consideration and output the grade of the steel.

#include<stdio.h>
#include<conio.h>
main()
{
float hard,carbon,tensile;
clrscr();
printf("Enter Hardness of steel : ");
scanf("%f",&hard);
printf("Enter Carbon content of steel : ");
scanf("%f",&carbon);
printf("Enter Trnsile strength of steel : ");
scanf("%f",&tensile);
if(hard>50&&carbon<0.7&&tensile>5600)
printf("\nThe grade of steel is 10");
else if(hard>50&&carbon<0.7)
printf("\nThe grade of steel is 9");
else if(carbon<0.7&&tensile>5600)
printf("\nThe grade of steel is 8");
else if(hard>50&&tensile>5600)
printf("\nThe grade of steel is 7");
else if(hard>50||carbon<0.7||tensile>5600)
printf("\nThe grade of steel is 6");

http://letuscsolutions.weebly.com/chapter-2.html 8/23
8/25/2017 Chapter 2 - Let Us C Solutions
else
printf("\nThe grade of steel is 5");
getch();
}

(d) A library charges a fine for every book returned late. For first 5 days the fine is 50 paise,

for 6-10 days fine is one rupee and above 10 days fine is 5 rupees. If you return the book after

30 days your membership will be cancelled. Write a program to accept the number of days

the member is late to return the book and display the fine or the appropriate message.

#include<stdio.h>
#include<conio.h>
main()
{
int days;
clrscr();
printf("Enter the number of days the member is late to return the book : ");
scanf("%d",&days);
if(days<=5)
printf("\nYou must pay 50 paisa fine..."); // '\n' is used for new line
else if(days>=6&&days<=10)
printf("\nYou must pay 1 rupee fine...");
else if(days>10&&days<30)
printf("\nYou must pay 5 rupees fine...");
else if(days>=30)
printf("\nYour membership is cancelled...");
getch();
}

(e) If the three sides of a triangle are entered through the keyboard, write a program to check

whether the triangle is valid or not. The triangle is valid if the sum of two sides is greater than

the largest of the three sides.

#include<stdio.h>
#include<conio.h>
main()
{
float s1,s2,s3; //s1=side1,s2=side2,s3=side3
clrscr();
printf("Enter three sides of triangle in ascending order:\n");
scanf("%f%f%f",&s1,&s2,&s3);
if(s1+s2>s3)
printf("\nThe triangle is valid.");
else
printf("\nThe triangle is invalid.");
getch();
}

http://letuscsolutions.weebly.com/chapter-2.html 9/23
8/25/2017 Chapter 2 - Let Us C Solutions

(f) If the three sides of a triangle are entered through the keyboard, write a program to check

whether the triangle is isosceles, equilateral, scalene or right angled triangle.

#include<stdio.h>
#include<conio.h>
main()
{
float a1,a2,a3; //a1=angle1,a2=angle2,a3=angle3
clrscr();
printf("Enter three angles of a triangle:\n");
scanf("%f%f%f",&a1,&a2,&a3);
if((a1+a2+a3)==180)
{
if(a1==a2&&a1==a3&&a2==a3)
printf("\nThe triangle is Equilateral.");
else if(a1==a2||a1==a3||a2==a3)
printf("\nThe triangle is Isosceles.");
else if(a1==90||a2==90||a3==90)
printf("\nThe triangle is Right Angled.");
else if(a1!=a2&&a1!=a3&&a2!=a3)
printf("\nThe triangle is Scalene");
}
else
printf("The triangle is not valid");
getch();
}

(g) In a company, worker efficiency is determined on the basis of the time required for a

worker to complete a particular job. If the time taken by the worker is between 2 3 hours,

then the worker is said to be highly efficient. If the time required by the worker is between 3

4 hours, then the worker is ordered to improve speed. If the time taken is between 4 5

hours, the worker is given training to improve his speed, and if the time taken by the worker

is more than 5 hours, then the worker has to leave the company. If the time taken by the

worker is input through the keyboard, find the efficiency of the worker.

#include<stdio.h>
#include<conio.h>
main()
{
float h; //h=hours
clrscr();
printf("Enter the time taken by the worker (In Hours) : ");
scanf("%f",&h);
if(h>=2&&h<=3)
printf("\nWorker is highly efficient.");
else if(h>=3&&h<=4)

http://letuscsolutions.weebly.com/chapter-2.html 10/23
8/25/2017 Chapter 2 - Let Us C Solutions
printf("\nWorker should improve his speed.");
else if(h>=4&&h<=5)
printf("\nWorker should take training to improve the speed.");
else if(h>=5)
printf("\nWorker has to leave the company.");
getch();
}

(h) The policy followed by a company to process customer orders is given by the following

rules:

(a) If a customer order is less than or equal to that in stock and has credit is OK, supply has

requirement.

(b) If has credit is not OK do not supply. Send him intimation.

(c) If has credit is Ok but the item in stock is less than has order, supply what is in stock.

Intimate to him data the balance will be shipped.

Write a C program to implement the company policy.

Coming Soon...

[K] Attempt the following:


(a) Using conditional operators determine:

(1) Whether the character entered through the keyboard is a lower case alphabet or not.

#include<stdio.h>
#include<conio.h>
main()
{
char ch; //ch=character
clrscr();
printf("Enter any charcter to find out weather it is lower case or not : ");
scanf("%c",&ch);
(ch>=97&&ch<=122?printf("\nThe input character is lower case."):printf("\nThe input
character is not lower case."));
getch();
}

(2) Whether a character entered through the keyboard is a special symbol or not.

#include<stdio.h>
#include<conio.h>
main()
{
char ch; //ch=character
clrscr();
printf("Enter any charcter to find out weather it is special symbol or not : ");

http://letuscsolutions.weebly.com/chapter-2.html 11/23
8/25/2017 Chapter 2 - Let Us C Solutions
scanf("%c",&ch);
((ch>=0&&ch<=47)||(ch>=58&&ch<=64)||(ch>=91&&ch<=96)||(ch>=123&&ch<=127)?
printf("\nThe input character is special symbol."):printf("\nThe input character is not special
symbol."));
getch();
}

(b) Write a program using conditional operators to determine whether a year entered through

the keyboard is a leap year or not.

#include<stdio.h>
#include<conio.h>
main()
{
int year;
clrscr();
printf("Enter any year : ");
scanf("%d",&year);
((year%4==0&&year%100!=0)||(year%400==0)?printf("\n%d is a leap
year.",year):printf("\n%d is not a leap year.",year));
getch();
}

(c) Write a program to find the greatest of the three numbers entered through the keyboard

using conditional operators.

#include<stdio.h>
#include<conio.h>
main()
{
int n1,n2,n3; //n1=1st number,n2=2nd number,n3=3rd number
clrscr();
printf("Enter three numbers:\n");
scanf("%d%d%d",&n1,&n2,&n3);
(n1>n2&&n1>n3?printf("\n%d is greater.",n1):(n2>n3&&n2>n1?printf("\n%d is
greater.",n2):printf("\n%d is greater.",n3)));
getch();
}
Back to Top

55 Comments Let Us C Solutions


1 Login

Sort by Best
Recommend 15 Share

Join the discussion

LOG IN WITH
http://letuscsolutions.weebly.com/chapter-2.html 12/23
8/25/2017 Chapter 2 - Let Us C Solutions
LOG IN WITH

OR SIGN UP WITH DISQUS ?

Name

A.WaHaB 4 years ago


plz solve this program. and send me source file
The policy followed by a company to process customer orders is given by the
following rules:

(a) If a customer order is less than or equal to that in stock and has credit is
OK, supply has requirement.

(b) If has credit is not OK do not supply. Send him intimation.

(c) If has credit is Ok but the item in stock is less than has order, supply what
is in stock. Intimate to him data the balance will be shipped.

Write a C program to implement the company policy.


10 Reply Share

faizi > A.WaHaB 3 years ago


good ques
2 Reply Share

prem > A.WaHaB 2 years ago


ji the question for me
Reply Share

Hafsa Ameer 3 years ago


The policy followed by a company to process customer orders is given by the
following rules:

(a) If a customer order is less than or equal to that in stock and has credit is
OK, supply has requirement.

(b) If has credit is not OK do not supply. Send him intimation.

(c) If has credit is Ok but the item in stock is less than has order, supply what
is in stock. Intimate to him data the balance will be shipped.

http://letuscsolutions.weebly.com/chapter-2.html 13/23
8/25/2017 Chapter 2 - Let Us C Solutions

Write a C program to implement the company policy.

plz solve this problem


5 Reply Share

prem > Hafsa Ameer 2 years ago


ji i solved ur answer using c program but i dont no to use in ponter
variables
Reply Share

Usama > Hafsa Ameer 3 years ago


hey its a C# code you can convert it in C. Thank you

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace practice_makes_a_man_perfect

class Program

static void Main(string[] args)


see more

Reply Share

A 4 years ago
According to the Gregorian calendar, it was Monday on the date 01/01/1900.
If any year is input through the keyboard write a program to find out what is
the day on 1st January of this year.
Answer:
void main()
{
float days;
int year,diff,leap,type;
http://letuscsolutions.weebly.com/chapter-2.html 14/23
8/25/2017 Chapter 2 - Let Us C Solutions

long int days1;


printf("\nInput the year");
scanf("%d",&year);
year=year-1;
diff=year-1900;

/* The line year=year-1 was written because we are finding the days before
that particular year not that full year as the required date is 01/01/year.

In days... 365 was added because the year 1900 has to be taken into account
as 1900-1904 is not 1904-1900=4years but is 5 years. 1900 is not a leap
see more

2 Reply Share

Asad ur rehman 4 years ago


thank u
2 Reply Share

saurav raghaw 3 years ago


Hello sir , the solution of questn. E is totally wrong . u r printg the reverse no.
By d help of 5 variable and it is not the solution ,der should b a single variable
holding d reverse no.
So kindly write d ri8 logic and please do understand What is a Reverse no.
Mean ? . num=123, numrev =321 .

~Saurav ( IIT - kanpur, Btech. CSE)


1 Reply Share

aditya > saurav raghaw 3 years ago


int reverse = 0;
while (numb > 0)
{
int rem = numb % 10;
reverse = (reverse * 10) + rem;

numb = numb / 10;


}

this is the logic


Reply Share

animesh 3 years ago


C(k)#include<stdio.h>
http://letuscsolutions.weebly.com/chapter-2.html 15/23
8/25/2017 Chapter 2 - Let Us C Solutions
C(k)#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float area,ard,r,x,y,z;//ard is area to be determined
printf("coordinate of center of circle is (0,0) and its radius is 8\n");//coordinate
of center of circle and radius is given accrdng 2 the ques. u may assume any
othr also

printf("enter the coordinate (x,y)\n");


scanf("%f%f",&x,&y);
area=3.14*8*8;
z=pow(x,2)+pow(y,2);
r=sqrt(z);
ard=3.14*r*r;
if(ard<area) printf("coordinates="" lies="" inside="" the="" circle");="" else=""
if(ard="=area)" printf("coordinates="" lies="" on="" the="" circle");="" else=""
printf("coordinates="" lies="" outside="" the="" circle");="" getch();="" }="">
1 Reply Share

Sudip Modak 4 years ago


The answer of G-h:

#include<stdio.h>

int main()

int stock,order;

char credit;

printf("Enter the stock of the company : ");

scanf("%d",&stock);

printf("Enter the order of the customer : ");

scanf("%d",&order);

printf("Is the credit has been made (y/n) : ");


see more

1 Reply Share
http://letuscsolutions.weebly.com/chapter-2.html 16/23
8/25/2017 Chapter 2 - Let Us C Solutions
1 Reply Share

Humza 5 years ago


irtiqa tmhara left click disable ko enable karna aa gaya:-D
1 Reply Share

shahidul > Humza 4 years ago


you have done great work solving these problems,but most of your
solutions are wrong.
4 Reply Share

Humza 5 years ago


Irtiqa c ke part i me area ka formula sahi nahi lag raha hai .
it maight be length*breadth/2
1 Reply Share

Sajid Ali 5 months ago


plz give the solution of above (d)
Reply Share

yugandhar rao a year ago


Identify the logic behind the series

6 28 66 120 190 276....

The numbers in the series should be used to create a Pyramid. The base of
the Pyramid will be the widest and will start converging towards the top where
there will only be one element. Each successive layer will have one number
less than that on the layer below it. The width of the Pyramid is specified by
an input parameter N. In other words there will be N numbers on the bottom
layer of the pyramid.

The Pyramid construction rules are as follows


First number in the series should be at the top of the Pyramid
Last N number of the series should be on the bottom-most layer of the
Pyramid, with Nth number being the right-most number of this layer.
Numbers less than 5-digits must be padded with zeroes to maintain the
sanctity of a Pyramid when printed. Have a look at the examples below to get
a pictorial understanding of what this rule actually means.
Reply Share

Rahul Patel 2 years ago

http://letuscsolutions.weebly.com/chapter-2.html
#include<stdio.h> 17/23
8/25/2017 Chapter 2 - Let Us C Solutions
#include<stdio.h>

#include<math.h>

void main()

int x,y,r=5;

int a,b,d;

printf("enter point");

scanf("%d%d",&a,&b);

printf("enter center of circle")

scanf("%d%d",&x,&y);

d=sqrt((pow((x-a),2)+pow((y-b),2)));
see more

Reply Share

MUSADDIQ khan 2 years ago


please Question c ka part 'd' aur 'k' jald upload kar dein thanx
Reply Share

Zeeshan Ahmed 2 years ago


can u plz solve Q no (b) without using if else statement
Reply Share

Syed Hasan Taqvi 2 years ago


to enable right click from chrome go to developer tools then settings and
disable javascript, then you can copy the code :)
Reply Share

Syed Hasan Taqvi 2 years ago


to enable right click from chrome go to developer tools then settings and
disable javascript, then you can copy the code :)
Reply Share

Nidhi 2 years ago


if coordinates are 0 in ques in which it is asked all points lie on same point
http://letuscsolutions.weebly.com/chapter-2.html 18/23
8/25/2017 Chapter 2 - Let Us C Solutions
if coordinates are 0 in ques in which it is asked all points lie on same point
den by the above logic it fails
Reply Share

Muhamad Abdullah 2 years ago


can u plz told me how to get these solutions in java?
Reply Share

Shaker Shafi 2 years ago


pliz solve the question (write a program which takes names of five countrise
as input and prints them in alphabetical order
Reply Share

Anonymous 2 years ago


In G(f) they have asked to enter the sides of triangle not the angles. so it
should be

#include<stdio.h>

#include<conio.h>

int main()

int a,b,c;

printf("Enter sides of triangle:");

scanf("%d%d%d",&a,&b,&c);

if(a==b&&a==c&&b==c)

printf("\nThese are the sides of Equilateral triangle.");

see more

Reply Share

Syed Hasan Taqvi > Anonymous 2 years ago


to enable the right click from chrome, go to developer tools then
setting and disable javascript. now you can copy the code :)
Reply Share

priti 3 years ago


http://letuscsolutions.weebly.com/chapter-2.html 19/23
8/25/2017 Chapter 2 - Let Us C Solutions

Can any1 solve dis prob:


Paper of size A0 has dimensions 1189mm*841mm. Each subsequent size
A(n) is defined as A(n-1) cut in half parallel to its shorter sides. Write a
program to calculate and print paper sizes A0, A1,....A8.
Reply Share

noor 3 years ago


hy friends plz solve the program..............write a program to get exactly 4 later
password (show *)
hint getch()
Reply Share

ranaalihassan > noor 3 years ago


Enter three angles of a triangle and find if the triangle is valid or not.
(Hint: sum of three angles are 180)
Reply Share

dakata 3 years ago


I am sorry ... this is my code&

#include <stdio.h>

#include <math.h>

/*Given the coordinates (x, y)of a center of a circle and its radius,

write a program which will determine whether a point lies inside

the circle, on the circle or outside the circle.*/

int main()

float x, y, r; //Coordinates of a center of a circle and its radius

float xn, yn, a, b; //xn and yn are the coordinates of an any point in or out of a
circle

see more

Reply Share

dakata 3 years ago


What are you think for this solution of k)
http://letuscsolutions.weebly.com/chapter-2.html 20/23
8/25/2017 Chapter 2 - Let Us C Solutions
What are you think for this solution of k)


Reply Share

chetan raikwar 4 years ago


http://letuscalllessons.blo...
Reply Share

Sayyaf 4 years ago


CALENDAR PROGRAM

#include <stdio.h>

int main ()

int a,b,c,d,e,f,day;

printf ("Enter the year after 1990: ");

scanf ("%d", &a);

b=(a-1)-1990;

for (c=1990,f=0; c<a; c++)="" {d="c%4;" if="" (d="=0)" f++;}="" e="(b*365)+f;"


day="e%7;" switch="" (day)="" {="" case="" 6:="" printf="" ("its="" monday");=""
break;="" case="" 5:="" printf="" ("its="" sunday");="" break;="" case="" 4:=""
printf="" ("its="" saturday");="" break;="" case="" 3:="" printf="" ("its=""
friday");="" break;="" case="" 2:="" printf="" ("its="" thursday");="" break;=""
case="" 1:="" printf="" ("its="" wednessday");="" break;="" case="" 0:=""
printf="" ("its="" tuesday");="" break;="" }="" getchar="" ();="" getchar="" ();=""
return="" 0;="" }="">
Reply Share

kainat malik > Sayyaf 4 years ago


samj nai aa rahi..
2 Reply Share

vaibhav 4 years ago

http://letuscsolutions.weebly.com/chapter-2.html 21/23
8/25/2017 Chapter 2 - Let Us C Solutions

thank you
Reply Share

MAHAM 4 years ago


BAQI KIDR HA SOLVE EXERCISE
Reply Share

asya 4 years ago


I think names should not used in c pprogram
Reply Share

ranaalihassan > asya 3 years ago


Enter three angles of a triangle and find if the triangle is valid or not.
(Hint: sum of three angles are 180)\
Reply Share

nikitha 4 years ago


g(f) soln is wrong since sides need to be entered not angles,inappropriate
program according to question
Reply Share

nikitha 4 years ago


solution for j is wrong since (1,2),(4,6),(12,14) are not collinear but its showing
collinear
Reply Share

NoorullahKazmi 4 years ago


C(e) solution is wrong if any one inputs 11111 then the program will also say
not equal to original
Reply Share

jaikant 4 years ago


your ans k (solution no c) is not run ..........................................
Reply Share

logic 4 years ago


Your C (e) solution is wrong if any one enter 55555 then also it will say not
equal
Reply Share

kirti > logic 2 years ago


http://letuscsolutions.weebly.com/chapter-2.html 22/23
8/25/2017 Chapter 2 - Let Us C Solutions
kirti > logic 2 years ago
because 55555 does not come under int. I think u have to use double
instead of int.
Reply Share

Sushil Jaiswal > logic 2 years ago


Yes u said correctly
Reply Share

jhanwi > logic 4 years ago


point to be noted
Reply Share

Parveen Anand 4 years ago


thanx for solution
Reply Share

dua khan 5 years ago


thaks to solve all problems :)
Reply Share

Shaiza 5 years ago


Thanks :)
Reply Share

Load more comments

http://letuscsolutions.weebly.com/chapter-2.html 23/23

Вам также может понравиться