0% found this document useful (0 votes)
18 views

Lab 1

The document contains 4 C programs that perform basic calculations and input/output operations. The first program calculates the sum of two user-input integers. The second program prints a name and student ID. The third program calculates the area and circumference of a circle given its radius. The fourth program calculates the sum and division of two user-input floats and prints a user-input character.

Uploaded by

Abdullah Abid
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Lab 1

The document contains 4 C programs that perform basic calculations and input/output operations. The first program calculates the sum of two user-input integers. The second program prints a name and student ID. The third program calculates the area and circumference of a circle given its radius. The fourth program calculates the sum and division of two user-input floats and prints a user-input character.

Uploaded by

Abdullah Abid
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include<stdio.

h>
void main(void)
{

int i;
int j;
int k;

printf("Enter the value of i and j:\n");


scanf_s("%d%d", &i, &j);
k = i + j;
printf("k=%d\n", k);
}

#include<stdio.h>
void main(void)
{

printf("******************\n");
printf("* SAAD AHMED *\n");
printf("* BEE183019 *\n");
printf("******************\n");

#include<stdio.h>
void main(void)
{
const float pi = 3.14;
int r;
float area, circumference;

printf("Enter the value of radius=");


scanf_s("%d", &r);
area = pi*r*r;
printf("area=%f\n", area);
circumference = 2 * pi*r;
printf("circumference=%f\n", circumference);

#include<stdio.h>
void main(void)
{
float x, y, div;
int sum = 0;
char z;

printf("Enter the first number=");


scanf_s("%f", &x);
printf("Enter the second number=");
scanf_s("%f", &y);
printf("Enter the Character=");
scanf_s(" %c", &z);
sum = x + y;
div = sum / 5;
printf("%f\n", div);
printf("character=%c\n", z);

You might also like