Sunday, 29 June 2025

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 2

 

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 2


Q:(f) Wind chill factor is the felt air temperature on exposed skin due to 
wind. The wind chill temperature is always lower than the air 
temperature, and is calculated as per the following formula: 
wcf = 35.74 + 0.6215t + ( 0.4275t - 35.75 ) * v0.16 
where t is the temperature and v is the wind velocity. Write a 
program to receive values of t and v and calculate wind chill factor 
(wcf).

#include <stdio.h>
#include <math.h>

int main()
{
    double t, v, wcf;
    printf("Enter the temperature in Fahrenheit: ");
    scanf("%lf", &t);
    printf("Enter the wind velocity in mph: ");
    scanf("%lf", &v);
    wcf = 35.74 + 0.6215 * t + (0.4275 * t - 35.75) * pow(v, 0.16);
    printf("The Wind Chill Factor (WCF) is: %lf\n", wcf);
    return 0;
}



Thursday, 26 June 2025

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 2

 Q: (e) Write a program to receive values of latitude (L1, L2) and longitude (G1, G2), in degrees, of two places on the earth and output the distance (D) between them in nautical miles. The formula for distance in nautical miles is: D = 3963 cos-1 ( sin L1 sin L2 + cos L1 cos L2 * cos ( G2 – G1 ) )


#include <stdio.h>

#include<math.h>

int main()

{

    double l1,l2,g1,g2,D;

    printf("Enter Latitudes L1 & L2");

    scanf("%lf%lf",&l1,&l2);

    printf("Enter Longitudes G1 & G2");

    scanf("%lf%lf",&g1,&g2);

    D=3963*acos(sin(l1)*sin(l2)+cos(l1)*cos(l2)*cos(g2-g1));

    printf("Nautical Miles = %lf",D);

    return 0;

}




Download Source Code

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 2

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 2

 

Q: (d) Write a program to receive Cartesian co-ordinates (x, y) of a point and convert them into polar co-ordinates (r, ). Hint: r = sqrt ( x2 + y2 ) and  𝝫 = tan-1 ( y / x )


#include <stdio.h>

#include<math.h>

int main()

{

    double x,y,r,p;

    printf("Enter Cartesian Co-ordinates x,y :\n");

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

    r=sqrt(x*x+y*y);

    p=atan(y/x);

    printf("Polar Co-ordinates are ( %lf , %lf )",r,p);

    return 0;

}



Download Source Code


C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 2

 Q: (c) If lengths of three sides of a triangle are input through the keyboard, write a program to find the area of the triangle.


#include <stdio.h>

#include<math.h>

int main()

{

    double a, b, c, s, area;

    printf("Enter the length of side a:\n");

    scanf("%lf", &a);

    printf("Enter the length of side b:\n");

    scanf("%lf", &b);

    printf("Enter the length of side c:\n");

    scanf("%lf", &c);

    s = (a + b + c) / 2;

    area = sqrt(s * (s - a) * (s - b) * (s - c));

    printf("The area of the triangle is: %lf", area);

    return 0;

}






Download Source Code

Wednesday, 25 June 2025

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 2

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 2

Q:(b)If a five-digit number is input through the keyboard, write a 

program to reverse the number.

#include <stdio.h>


int main()

{

    long int n;

    int s=0,r;

    printf("Enter Number\n");

    scanf("%ld",&n);

    while(n>0)

    {

        r=n%10;

        s=s*10+r;

        n=n/10;

    }

    printf("Reverse of Number is %d",s);

    return 0;

}





 







Download Source Code

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 2

 

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 2


Q: (a) If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits. (Hint: Use the modulus operator ‘%’)


#include <stdio.h>
int main()
{
    long int n;
    int s=0,r;
    printf("Enter Number\n");
    scanf("%ld",&n);
    while(n>0)
    {
        r=n%10;
        s=s+r;
        n=n/10;
    }
    printf("Sum of Digits is %d",s);
    return 0;
}


C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 1

 Q:(f) Paper of size A0 has dimensions 1189 mm x 841 mm. Each subsequent size A(n) is defined as A(n-1) cut in half parallel to its shorter sides. Thus paper of size A1 would have dimensions 841 mm x 594 mm. Write a program to calculate and print paper sizes A0, A1, A2, … A8.

#include <stdio.h>

int main()

{

    double a[9][2]={{1189,841}};

    int i,j;

    for(i=1;i<=8;i++)

    {

        for(j=0;j<=0;j++)

        {

            if(a[i-1][j]>a[i-1][j+1])

            {

                a[i][j+1]=a[i-1][j]/2;

                a[i][j]=a[i-1][j+1];

            }

            else

            {

                a[i][j+1]=a[i-1][j+1]/2;

                a[i][j]=a[i-1][j];


            }

        }

    }

    for(i=0;i<=8;i++)

    {

        for(j=0;j<=1;j++)

        {

            printf("%lf\t",a[i][j]);

        }

        printf("\n");

    }

    return 0;

}







Tuesday, 24 June 2025

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 1

Q: (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>

int main()

{

    double l,b,arearec,perirec,r,areacir,circumcir;

    printf("Enter Length & Breadth of Rectangle\n");

    scanf("%lf%lf",&l,&b);

    printf("Enter Radius of Circle\n");

    scanf("%lf",&r);

    arearec=l*b;

    perirec=2*(l+b);

    areacir=3.14*r*r;

    circumcir=2*3.14*r;

    printf("Area of Rectangle is %lf\n",arearec);

    printf("Perimeter of Rectangle is %lf\n",perirec);

    printf("Area of Circle is %lf\n",areacir);

    printf("Circumference of Circle is %lf\n",circumcir);

    return 0;

}



Download Source Code

Page : 1 2 3 4 5

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 1

 Q: (d) Temperature of a city in Fahrenheit degrees is input through the keyboard. Write a program to convert this temperature into Centigrade degrees.

#include <stdio.h>

int main()

{

    double f, c;

    printf("Enter temperature in Fahrenheit: ");

    scanf("%lf", &f);

    c=(f - 32) * 5.0 / 9.0;

    printf("%lf Fahrenheit is equal to %lf Celsius\n", f, c);

    return 0;

}



Download Source Code

Page : 1 2 3 4 5

Tuesday, 17 June 2025

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 1

Q: (c) If the marks obtained by a student in five different subjects are input through the keyboard, write a program to find out the aggregate marks and percentage marks obtained by the student. Assume that the maximum marks that can be obtained by a student in each subject is 100.

/*Q: (c) If the marks obtained by a student in five different subjects are input through the keyboard,

write a program to find out the aggregate marks 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>

void main()

{

double m1,m2,m3,m4,m5,tot,per;

clrscr();

printf("Enter Marks in 5 Subjects out of 100 each\n");

printf("Enter Marks in Subject 1\n");

scanf("%lf",&m1);

printf("Enter Marks in Subject 2\n");

scanf("%lf",&m2);

printf("Enter Marks in Subject 3\n");

scanf("%lf",&m3);

printf("Enter Marks in Subject 4\n");

scanf("%lf",&m4);

printf("Enter Marks in Subject 5\n");

scanf("%lf",&m5);

tot=m1+m2+m3+m4+m5;

per=tot/5;

printf("Total Marks = %lf\n",tot);

printf("Percentage = %lf",per);

getch();

}






Page : 1 2 3 4 5