Professional Documents
Culture Documents
Cs110 ASSIGNMENT-1 Basic Input Output Functions: Name-Ritul Ranjan Section-S4 Rollno-201cv144
Cs110 ASSIGNMENT-1 Basic Input Output Functions: Name-Ritul Ranjan Section-S4 Rollno-201cv144
Section-S4
Rollno-201cv144
Cs110 ASSIGNMENT-1
#include <stdio.h>
#include<math.h>
int main()
{
float amt, time, rate, si ,ci;
return 0;
}
QUESTION 2-To read the radius of a circle and find its Area and Perimeter
#include <stdio.h>
int main()
{
float rad,area, perm;
printf("\n");
return 0;
}
QUESTION 3-To read the temperature in Fahrenheit and convert it to degree centigrade.
#include <stdio.h>
int main()
{
float fah,cen;
return 0;
}
QUESTION 4-Program to accept student roll no, marks in 3 subjects and calculate total, average
of marks and print them with appropriate messages.
#include <stdio.h>
int main()
{
float rollno,s1,s2,s3,total,average;
printf("\n");
return 0;
}
QUESTION 5-An Employee's Basic Pay (BP) is to be read through a keyboard. DA is 40% of BP,
HRA is 20% of BP, calculate the Gross Pay (GP) GP is computed as BP+DA+HRA
#include <stdio.h>
int main()
{
float bp,da,hra,gp;
printf("ENTER BASIC PAY:");//enter basic pay
scanf("%f",&bp);
da=0.4*bp;//calculate da
printf("DA =%f",da);//print da
printf("\n");
hra=0.2*bp;//calculate hra
printf("HRA=%f",hra);//print hra
printf("\n");
return 0;
}
QUESTION 6-Program to find the distance between two points (x1, y1) and (x2, y2) in a
Cartesian plane.
#include <stdio.h>
#include<math.h>
int main()
{
float x1,x2,y1,y2,dis;
return 0;
}
QUESTION 7-Program to swap two numbers using a temporary variable. Also print the original
and exchanged values
#include <stdio.h>
int main()
{
float n1,n2,var;
printf("\n");
return 0;
}
#include <stdio.h>
int main()
{
float meters,km,cm,ft,inch;
printf("Enter distance in kilometer:");//enter distance in km
scanf("%f",&km);
meters=km*1000;//convert km to meters
cm=meters*100;//convert km to centimeter
ft=3.28084*meters;//convert km to feet
inch=12*ft;//convert km to inches
printf("\n");
printf("\n");
printf("\n");
return 0;
}
QUESTION 2-The length & breadth of a rectangle and radius of a circle are input through the
keyboard. Write a program to calculate the area & perimeter of the rectangle, and the area &
circumference of the circle.
#include <stdio.h>
int main()
{
float len,bre,rad,a1,a2,p1,p2;
scanf("%f",&len);
scanf("%f",&bre);
scanf("%f",&rad);
printf("\n");
printf("\n");
QUESTION 3-. If a five-digit number is input through the keyboard, write a program to calculate
the sum of its digits
#include <stdio.h>
int main()
{
int num,sum,u,t,h,th,tth;
printf("sum of the digits of the number is=%d",sum);//print the sum of the digits of the five
digit number
return 0;
}
QUESTION 4-If a five-digit number is input through the keyboard, write a program to reverse the
number.
#include <stdio.h>
int main()
{
int num,rev,u,t,h,th,tth;
return 0;
}
QUESTION 5-If the total selling price of 15 items and the total profit earned on them is input
through the keyboard, write a program to find the cost price of one item.
#include <stdio.h>
int main()
float tp,prof,cp;
printf(" Enter the total selling price Of 15 items:");//total selling price of 15 items
scanf("%f",&tp);
scanf("%f",&prof);
printf("The Cost Price of one item is : %f",cp);//print cost price of one item
return 0;
QUESTION 6-Write a program to compute the values of square-roots and squares of the numbers 0
to 100 in steps 10