Professional Documents
Culture Documents
LAB REPORT 1
LAB REPORT 1
#include <stdio.h>
int main()
{
printf(“Texas International College”);
return 0;
}
2) Write a program to add, subtract, multiply, and divide two whole numbers.
Program to add, subtract, multiply, and divide two whole number is listed below:
#include<stdio.h>
#include<conio.h>
int main()
{
int num1, num2, res;
printf(“Enter any two whole number:”);
scanf(“%d%d”, &num1, &num2);
res = num1+num2;
printf(“\n Addition = %d”, res);
res = num1-num2;
printf(“\n subtraction = %d”, res);
res = num1*num2;
printf(“\n Multiplication = %d”, res);
res = num1/num2;
printf(\n Division = %d”, res);
getch();
return 0;
}
int main()
{
return 0;
}
#include<stdio.h>
int main()
{
float celcius, fahrenheit;
printf("enter temperature in celcius:");
scanf("%f", &celcius);
#include<stdio.h>
#include<math.h>
int main(){
double num, root;
printf("Enter an integer:");
scanf("%lf", &num);
root = sqrt (num);
#inlcude<stdio.h>
int main() {
int base, exp;
long double result = 1.0;
While (exp != 0) {
result *= base;
--exp;
}
printf(“Answer = %.0Lf”, result);
return 0;
}
int main() {
float pi=3.14, area, circumference, radius;
return 0;
}
#include <stdio.h>
void main() {
float length, width, perimeter, area;
#include <stdio.h>
int main() {
float base, height, area;
return 0;
}
#include<stdio.h>
int main()
{
float KG = 0.453592, pound;
return 0;
}
#include <stdio.h>
int main() {
while (n != 0) {
remainder = n % 10;
reverse = reverse * 10 + remainder;
n /= 10;
}
return 0;
}
#include <stdio.h>
int main(void) {
float dollars;
13) Write a program to express a length given in kilometers in meters, centimeters, millimeters.
Program to express a length given in kilometers in meters, centimeters, and millimeters is listed
below:
#include <stdio.h>
int main()
{
float Millimeter, Centimeter, Meter, Kilometer;
return 0;
}
#include<stdio.h>
int main() {
int x, y, temp;
printf("Enter the value of x and y: ");
scanf("%d %d", &x, &y);
printf("Before swapping x=%d, y=%d ", x, y);
/*Swapping logic */
temp = x;
x = y;
y = temp;
printf("After swapping x=%d, y=%d", x, y);
return 0;
}
15) Write a program to swap two numbers without using temporary variable.
int main()
{
int a,b;
a = a+b;
b = a-b;
a = a-b;
return 0;
}
16) Write a program to find the square and cube of a given number.
Program to find the square and cube of a given number is listed below:
#include <stdio.h>
int main()
{
int no;
printf("Enter a number : ");
scanf("%d", &no);
#include <stdio.h>
int main()
{
float eng, phy, chem, math, comp;
float total, average, percentage;
return 0;
}
18) Write a program to sum the digit of as positive integer which is 5 digits long.
Program to sum the digit of a positive integer which is 5 digits long is listed below:
#include <stdio.h>
int main()
{
int n, t, sum = 0, remainder;
t = n;
while (t != 0)
{
remainder = t % 10;
sum = sum + remainder;
t = t / 10;
}
return 0;
}
19) Write a program to find price of n mangos given the price of dozen mangos.
Program to find the price of n mangos given the price of dozen mangos is listed below:
#include <stdio.h>
int main() {
// Declare variables
float dozenPrice, mangoPrice;
return 0;
}