Skip to content

Commit b05736b

Browse files
authored
Add files via upload
1 parent 9c0a07d commit b05736b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2586
-242
lines changed

Areaofcircle.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include<stdio.h>
2+
3+
int main() {
4+
5+
int radius;
6+
scanf("%d", &radius);
7+
8+
float Area = 3.14 * radius * radius;
9+
10+
printf("%f\n", Area);
11+
12+
return 0;
13+
14+
}

BMI.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include<stdio.h>
2+
#include<math.h>
3+
4+
int main() {
5+
6+
int weight, hieght;
7+
float bmi;
8+
9+
scanf("%d%d", &weight, &hieght);
10+
11+
weight = weight * 0.45359237;
12+
hieght = hieght * 0.0254;
13+
14+
bmi = weight/(pow(hieght, 2));
15+
16+
if (bmi < 18.5)
17+
{
18+
printf("Underweight\n");
19+
}
20+
21+
else if (bmi >= 18.5 && bmi < 25.0)
22+
{
23+
printf("Normal\n");
24+
}
25+
26+
else if (bmi >= 25.0 && bmi < 30.0)
27+
{
28+
printf("Overweight\n");
29+
}
30+
31+
else if (bmi >= 30.0)
32+
{
33+
printf("Obese\n");
34+
}
35+
36+
return 0;
37+
38+
}

add1tolargenumber.c

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#include<stdio.h>
2+
#include<string.h>
3+
#include<stdlib.h>
4+
5+
int main() {
6+
7+
char s[1000];
8+
9+
scanf("%s", &s);
10+
11+
int n = strlen(s);
12+
13+
int *Num_Array = (int*)malloc(sizeof(int)*n);
14+
int *Num_Array1 = (int*)calloc(n, sizeof(int));
15+
int *Res_array = (int*)malloc(sizeof(int)*n);
16+
17+
Num_Array1[n - 1] = 1;
18+
19+
for (int i = 0; i < n; i++)
20+
{
21+
Num_Array[i] = 0;
22+
}
23+
24+
for (int i = 0; i < n; i++)
25+
{
26+
Num_Array[i] = (s[i] - '0');
27+
}
28+
29+
int carry = 0;
30+
int sum = 0;
31+
32+
for (int i = n - 1; i >= 0; i--)
33+
{
34+
sum = Num_Array[i] + Num_Array1[i] + carry;
35+
Res_array[i] = sum % 10;
36+
carry = sum/10;
37+
}
38+
39+
if (carry != 0)
40+
{
41+
printf("%d", carry);
42+
43+
for (int i = 0; i < n; i++)
44+
{
45+
printf("%d", Res_array[i]);
46+
}
47+
48+
}
49+
50+
else{
51+
52+
for (int i = 0; i < n; i++)
53+
{
54+
printf("%d", Res_array[i]);
55+
}
56+
57+
}
58+
59+
return 0;
60+
61+
}

age.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include<stdio.h>
2+
3+
int main(){
4+
5+
int n;
6+
scanf("%d", &n);
7+
8+
int array[n];
9+
10+
for (int i = 0; i < n; i++)
11+
{
12+
scanf("%d", &array[i]);
13+
}
14+
15+
for (int i = 0; i < n; i++)
16+
{
17+
for (int j = 0; j < n - i; j++)
18+
{
19+
if(array[j] > array[j+1]){
20+
int temp = array[j];
21+
array[j] = array[j+1];
22+
array[j+1] = temp;
23+
}
24+
}
25+
}
26+
27+
printf("The Youngest Student's Age is %d and the Oldest Student's Age is %d\n", array[0], array[n-1]);
28+
29+
return 0;
30+
31+
}

allvowels.c

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#include<stdio.h>
2+
#include<string.h>
3+
4+
int main(){
5+
6+
char str[50];
7+
int array[5] = {0};
8+
gets(str);
9+
10+
int len = strlen(str);
11+
12+
for (int i = 0; i < len; i++)
13+
{
14+
if (str[i] == 'a')
15+
{
16+
array[0] = 1;
17+
continue;
18+
}
19+
20+
else if (str[i] == 'e')
21+
{
22+
array[1] = 1;
23+
continue;
24+
}
25+
26+
else if (str[i] == 'i')
27+
{
28+
array[2] = 1;
29+
continue;
30+
}
31+
32+
else if (str[i] == 'o')
33+
{
34+
array[3] = 1;
35+
continue;
36+
}
37+
38+
else if (str[i] == 'u')
39+
{
40+
array[4] = 1;
41+
continue;
42+
}
43+
}
44+
45+
for(int i = 0; i < 5; i++)
46+
{
47+
if(array[i] == 0){
48+
printf("All Vowels are not present\n");
49+
break;
50+
}
51+
52+
else{
53+
if(i == 4){
54+
printf("All Vowels are Present\n");
55+
break;
56+
}
57+
}
58+
}
59+
60+
return 0;
61+
62+
}

areaofrectangleusingfunction.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include<stdio.h>
2+
3+
void Area_Rectangle(int x, int y);
4+
5+
void Area_Circle(int rad);
6+
7+
int main() {
8+
9+
int length, breadth, radius;
10+
11+
scanf("%d%d%d", &length, &breadth, &radius);
12+
13+
Area_Rectangle(length,breadth);
14+
Area_Circle(radius);
15+
16+
return 0;
17+
18+
}
19+
20+
void Area_Rectangle(int x, int y) {
21+
22+
int Area = x * y;
23+
printf("The Area of Rectangle is : %d\n", Area);
24+
}
25+
26+
void Area_Circle(int rad) {
27+
28+
float Area = 3.14 * rad * rad;
29+
printf("The Area of Circle is : %f\n", Area);
30+
}

areaoftriangle.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include<stdio.h>
2+
#include<math.h>
3+
4+
int main() {
5+
6+
int side1, side2, side3;
7+
scanf("%d %d %d", &side1, &side2, &side3);
8+
9+
float s = (side1 + side2 + side3 / 2);
10+
float Area = sqrt(s*(s-side1)*s*(s-side2)*s*(s-side3));
11+
12+
printf("%d\n", Area);
13+
14+
return 0;
15+
16+
}

arithmeticfunction.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include<stdio.h>
2+
3+
int add(int a, int b);
4+
int sub(int a, int b);
5+
int multiply(int a, int b);
6+
int divide(int a, int b);
7+
8+
int main() {
9+
10+
int x,y;
11+
12+
scanf("%d%d", &x, &y);
13+
add(x,y);
14+
sub(x,y);
15+
multiply(x,y);
16+
divide(x,y);
17+
18+
return 0 ;
19+
}
20+
21+
int add(int a, int b) {
22+
23+
int sum = a + b;
24+
printf("The Sum is : %d\n", sum);
25+
}
26+
27+
int sub(int a, int b) {
28+
29+
int sum = a - b;
30+
printf("The Subtraction is : %d\n", sum);
31+
}
32+
33+
int multiply(int a, int b) {
34+
35+
int sum = a * b;
36+
printf("The Multiplication is : %d\n", sum);
37+
}
38+
39+
int divide(int a, int b) {
40+
41+
float sum = a / b;
42+
printf("The Division is : %f\n", sum);
43+
}

binarysearch.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#include<stdio.h>
2+
3+
int main(){
4+
5+
int n;
6+
scanf("%d", &n);
7+
8+
int array[n];
9+
10+
for (int i = 0; i < n; i++)
11+
{
12+
scanf("%d", &array[i]);
13+
}
14+
15+
int front = 0, last = n - 1;
16+
int target, mid;
17+
scanf("%d", &target);
18+
19+
while(front <= last){
20+
mid = (front+last)/2;
21+
22+
if(array[mid] == target){
23+
printf("Key Found\n");
24+
break;
25+
}
26+
27+
else if(target > array[mid]){
28+
front = mid + 1;
29+
}
30+
31+
else{
32+
last = mid - 1;
33+
}
34+
}
35+
36+
if(front > mid){
37+
printf("Key Not Found\n");
38+
}
39+
40+
return 0;
41+
42+
}

0 commit comments

Comments
 (0)