Code Monkey home page Code Monkey logo

ia2-test1-session2's Introduction


1. Write a program to find the area of a triangle using following function signatures.
void input(float *base, float *height);
void find_area(float base , float height, float *area);
void output(float base, float height, float area);
input:
1
2
output:
the area of the traingle with base 1.000000 and height 2.000000 is 1.000000


2. Write a program to find if a triangle is scalene. A triangle is a scalene traingle if all the three sides of the triangle are not equal to each other.

<br> int input_side()
<br> int check_scalene(int a, int b, int c)
<br> void output(int a, int b, int c, int isscalene)


3. Write a program find whether a number is a composite number. A Composite number has a factor other than 1 and itself
int input_number();
int is_composite(int n);
void output(int n, int composite);
input:
8
output:
8 is a composite number.


4. Write a program to find Sum of composite number in an array of numbers different containing numbers entered by the user.
int input_array_size();
void input_array(int n, int a[n]);
int sum_composite_numbers(int n, int a[n]);
void out_put(int sum);
input:
1 2 7 8 12
output:
20
5. Write a program to find gcd (hcf) of two numbers.
int input();
int gcd(int a, int b);
void output(int a, int b, int gcd); input: 12 16 output 4


6. Write a program to reverse a string.
void input_string(char *a);
char *str_reverse(char *a);
void output(char *a,char *reversea);
input:
hello
output:
olleh


7. Write a program to find the area of a triangle
struct _triangle
{
float base,altitude,area;
}; <brtypedef _triangle Triangle
Triangle input_triangle();
void find_area(Traingle *t);
void output(Triangle t);
input:
2 3
output:
The area of triangle wwith base = 2.000000 and altitude = 3.000000 is 3.000000


8. Write a program to find the triangle with smallest area in n given triangles.
struct _triangle
{
float base,altitude,area;
};
typedef _triangle Triangle
int input_n();
Triangle input_triangle();
void input_n_triangles(int n, triangle t[n]);
void find_area(Triangle *t);
void find_areas_n(int n, Triangle t[n]);
Triangle find_smallest_triangle(int n, Triangle t[n]);

void output(int n, Triangle t[n], Triangle smallest);
void
input:
2 3
4 6
the smallest of triangles with base and height
2,3 and
4,6
is
triangle with base 2.000000, 3.000000 is 3.000000
The area of triangle wwith base = 2.000000 and altitude = 3.000000 is 3.000000

ia2-test1-session2's People

Contributors

adarsh-menon avatar srinirad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.