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

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 1

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


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

void main()

{

double dkm,dm,dcm,dft,din;

clrscr();

printf("Enter Distance in KM");

scanf("%lf",&dkm);

dm=dkm*1000;

dcm=dm*100;

din=dcm*0.3937;

dft=dcm*0.0328;

printf("Distance in CM = %lf\n",dcm);

printf("Distance in Inches = %lf\n",din);

printf("Distance in Feet = %lf\n",dft);

printf("Distance in Meter = %lf",dm);

getch();

}









Download Source Code


Page : 1 2 3 4 5


Sunday, 15 June 2025

C Programming Solved Problems Let us C Yashwant Kanitkar Chapter 1

 Q: (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 calculate his gross salary.

Solution:

/*(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 calculate his gross salary.*/

#include<stdio.h>

#include<conio.h>

void main()

{

double b_sal,da,hra,g_sal;

clrscr();

printf("Enter basic salary");

scanf("%lf",&b_sal);

hra=0.20*b_sal;//House Rent Allowance

da=0.40*b_sal;//Dearness Allowance

g_sal=b_sal+da+hra;//Gross Salary

printf("Gross Salary = %lf",g_sal);

getch();

}

Output:



Download Source Code

Page : 1 2 3 4 5

Sunday, 19 January 2025

UGC NET COMPUTER SCIENCE AND APPLICATIONS PAPER - 2 Question 2 November 2017 Solution

Q: 2 Let m=(313)4 and n=(322)4 . Find the base 4 expansion of m+n.

(1) (635)4

(2) (32312)4

(3) (21323)4

(4) (1301)4

Answer: (4)

Explanation:


Firstly convert m & n into base 10:

(313)4 = 3*42+1*41+3*40 = (55)10
(322)4 = 3*42+2*41+2*40
 = (58)10

Now m + n = 55+58 = (113)10

Now Convert (113)10 into base 4

  • When 113 is divided by 4, the quotient is 28 and the remainder is 1.
  • When 28 is divided by 4, the quotient is 7 and the remainder is 0.
  • When 7 is divided by 4, the quotient is 1 and the remainder is 3.
  • When 1 is divided by 4, the quotient is 0 and the remainder is 1.

Write the remainders from bottom to top.

So, (113)10 = (1301)4      which is Correct.

UGC NET COMPUTER SCIENCE AND APPLICATIONS PAPER - 2 Question 1 November 2017 Solution

UGC NET COMPUTER SCIENCE AND APPLICATIONS PAPER - 2 November 2017 Solution


Q: 1 If the time is now 4 O’clock, what will be the time after 101 hours from now ? 

(1) 9 O’clock (2) 8 O’clock (3) 5 O’clock (4) 4 O’clock

Answer: (1)

To find the time after 101 hours from 4 o’clock, we can use the modulo operation with respect to 12 (since it’s a 12-hour clock).
  1. First, calculate the remainder when 101 is divided by 12:

    Quotient is 8 and Remainder is 5
  2. Now add this remainder to the current time: 

    i.e. 4+5 = 9

    Thus, 101 hours from 4 o’clock will be 9 o’clock.
    The correct answer is (1) 9 O’clock.



Try Your Self:
Q:  If the time is now 2 O’clock, what will be the time after 55 hours from now?
2 O’clock
3 O’clock
10 O’clock
9 O’clock