Professional Documents
Culture Documents
Assign 1 Pratham
Assign 1 Pratham
Assignment I
1)Write a program to print your name, scholar number and branch name
on the screen.
/*****************
Programme created by: Prathamesh Prashant Nikam
Scholar No.: 22U02050
Branch: Computer Science and Engineering
*****************/
#include <stdio.h>
int main()
{
printf("\nHello, my name is Prathamesh Prashant Nikam,\nmy scholar no. is
22U02050,\nand my branch is Computer Science and Engineering.");
return 0;
Output:
Hello, my name is Prathamesh Prashant Nikam,
my scholar no. is 22U02050,
and my branch is Computer Science and Engineering.
Name: Prathamesh Prashant Nikam Scholar No. 22U02050 Date: 23/11/2022
#include <stdio.h>
int main()
{
int num1=0;
int num2=0;
printf("Enter your first number:");
scanf("%d", &num1);
printf("\nEnter your second number:");
scanf("%d", &num2);
int sum= num1+num2;
int diff= num1-num2;
int prod= num1*num2;
float div= num1/(float)num2;
printf("\nSum of the two numbers is %d", sum);
printf("\nDifference of the two numbers is %d", diff);
printf("\nProduct of the two numbers is %d", prod);
printf("\nDivision of the two numbers is %f", div);
return 0;
Input:
5, 10.
Output:
Sum of the two numbers is 15
Difference of the two numbers is -5
Product of the two numbers is 50
Division of the two numbers is 0.500000
Name: Prathamesh Prashant Nikam Scholar No. 22U02050 Date: 23/11/2022
#include <stdio.h>
int main()
{
float rad=0;
printf("Enter the radius of a circle in metres:");
scanf("%f", &rad);
const float PI=3.1415926;
float area= PI*rad*rad;
float circum= 2.0*PI*rad;
printf("\nThe area of the circle is %f sq.mt and circumference of the
circle is %f m.", area, circum);
return 0;
}
Input:
14
Output:
The area of the circle is 615.752136 sq.mt and circumference of the
circle is 87.964592 m.
Name: Prathamesh Prashant Nikam Scholar No. 22U02050 Date: 23/11/2022
4)Write a program to calculate the area & perimeter of the rectangle. The
length & breadth of a rectangle are input through the keyboard.
/*****************
Programme created by: Prathamesh Prashant Nikam
Scholar No.: 22U02050
Branch: Computer Science and Engineering
*****************/
#include <stdio.h>
int main()
{
float length=0;
float breadth=0;
printf("Enter the length of the rectangle:");
scanf("%f",&length);
printf("\nEnter the breadth of the rectangle:");
scanf("%f",&breadth);
float perimeter= 2.0*(length+breadth);
float area= (length*breadth);
printf("\nPerimeter of the rectangle is %f and area of the rectangle is
%f", perimeter, area);
return 0;
}
Input:
14, 8.
Output:
Perimeter of the rectangle is 44.000000 and area of the rectangle is
112.000000.
Name: Prathamesh Prashant Nikam Scholar No. 22U02050 Date: 23/11/2022
#include <stdio.h>
int main()
{
float dollars=0;
printf("Enter the amount of your money in dollars:");
scanf("%f", &dollars);
float rupees=dollars*82.50;
printf("The amount of your money in rupees is %f", rupees);
return 0;
}
Input:
55.25
Output:
The amount of your money in rupees is 4558.125000.
Name: Prathamesh Prashant Nikam Scholar No. 22U02050 Date: 23/11/2022
#include <stdio.h>
int main()
{
float fahren=0;
printf("Enter the temperature of city in Fahrenheit:");
scanf("%f",&fahren);
float cel= (fahren-32)*(5/(float)9);
printf("The temperature of city in Centigrade is %f",cel);
return 0;
}
Input:
-40
Output:
The temperature of city in Centigrade is -40.000000