├── p2original.c
├── p3original.c
├── p4original.c
├── p5original.c
├── p6original.c
├── p7original.c
├── p8original.c
├── p1original.c
├── p1output.txt
├── p2output.txt
├── p3output.txt
├── p4output.txt
├── p5output.txt
├── p6output.txt
├── p7output.txt
├── p8output.txt
├── .replit
├── .gitignore
└── README.md
/p2original.c:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/p3original.c:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/p4original.c:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/p5original.c:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/p6original.c:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/p7original.c:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/p8original.c:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/p1original.c:
--------------------------------------------------------------------------------
1 |
2 | }
--------------------------------------------------------------------------------
/p1output.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/p2output.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/p3output.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/p4output.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/p5output.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/p6output.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/p7output.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/p8output.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/.replit:
--------------------------------------------------------------------------------
1 | language = "undefined"
2 | run = ""
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Object files
5 | *.o
6 | *.ko
7 | *.obj
8 | *.elf
9 |
10 | # Linker output
11 | *.ilk
12 | *.map
13 | *.exp
14 |
15 | # Precompiled Headers
16 | *.gch
17 | *.pch
18 |
19 | # Libraries
20 | *.lib
21 | *.a
22 | *.la
23 | *.lo
24 |
25 | # Shared objects (inc. Windows DLLs)
26 | *.dll
27 | *.so
28 | *.so.*
29 | *.dylib
30 |
31 | # Executables
32 | *.exe
33 | *.out
34 | *.app
35 | *.i*86
36 | *.x86_64
37 | *.hex
38 |
39 | # Debug files
40 | *.dSYM/
41 | *.su
42 | *.idb
43 | *.pdb
44 |
45 | # Kernel Module Compile Results
46 | *.mod*
47 | *.cmd
48 | .tmp_versions/
49 | modules.order
50 | Module.symvers
51 | Mkfile.old
52 | dkms.conf
53 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
1. Write a program to find the distance between two points
2 |
void input(float \*x1, float \*y1, float \*x2, float \*y2);
3 |
void find_distance(float x1, float y1, float x2, float y2, float *area);
4 |
void output(float x1, float y1,float x2, float y2, float area);
5 |
input:
6 |
1 1 2 2
7 |
output:
8 |
the distance between point (1.000000,1.000000) and (2.000000,2.000000) is with 1.4142
9 |
10 |
2. Write a program to find whether the three points form a triangle.
11 |
void input_triangle(float \*x1, float \*y1, float \*x2, float \*y2, float \*x3, float \*y3);
12 |
int is_triangle(float x1, float y1, float x2, float y2,float x3, float y3)
13 |
void output(float x1, float y1, float x2, float y2,float x3, float y3, int istriangle)
14 |
15 |
16 |
3. Write a program find whether a given number is a prime number.
17 |
int input_number();
18 |
int is_prime(int n);
19 |
void output(int n, int is_prime);
20 |
input:
21 |
3
22 |
output:
23 |
3 is a prime number.
24 |
25 |
4. Write a program to find nth number in fibonacci sequence.
26 |
Fibonacci sequence consists of 0,1,1,2,3,5,8,13,21........
27 |
int input();
28 |
int find_fibo(int n);
29 |
void output(int n, int fibo);
30 |
31 |
5. Write a program to find all the prime numbers between erotosthenes sieve method.
32 |
int input_array_size();
33 |
void init_array(int n, int a[n];
34 |
void erotosthenes_sieve(int n, int a[n]);
35 |
void out_put(int n, int a[n]);
36 |
input:
37 |
100
38 |
output:
39 |
2,3,7,11,13,19,23,29,31,...
40 |
41 |
42 |
6. Write a program to find the index of a substring of a string.
43 |
void input_string(char *a);
44 |
int str_reverse(char \*string, char \*substring);
45 |
void output(char \*string, char \*substring, int index);
46 |
input:
47 |
helloworldhello
48 |
world
49 |
output:
50 |
The index of world in helloworldhello is 5
51 |
52 |
7. Write a program to find the length of a line.
53 |
struct _point {
54 |
float x,y;
55 |
};
56 |
typedef struct _point Point;
57 |
struct _line
58 |
{
59 |
Point p1,p2;
60 |
float distance;
61 |
};
62 |
typedef struct _line Line
63 |
Point input_point();
64 |
Line input_line();
65 |
void find_length(Line \*l);
66 |
void output(Line l);
67 |
68 |
8. Write a program to find the permeter of a polygon
69 |
struct _point {
70 |
float x,y;
71 |
};
72 |
typedef struct _point Point;
73 |
struct _line
74 |
{
75 |
Point p1,p2;
76 |
float distance;
77 |
};
78 |
struct _line Line;
79 |
struct _polygon {
80 |
int n;
81 |
Line l[100];
82 |
float perimenter;
83 |
}
84 |
int input_n();
85 |
int input_polygon( int n, Polygon \*p);
86 |
Line input_line();
87 |
void input_n_lines(int n, Line l[n]);
88 |
void find_perimeter(Polygon \*p);
89 |
void output(Polygon p);
90 |
91 |
--------------------------------------------------------------------------------