C Program to Find Perimeter of Rhombus

C Program to Find Perimeter of Rhombus

C program to find perimeter of rhombus; Through this tutorial, we will learn how to find or calculate perimeter of rhombus using standard formula, function and pointer in c programs.

Programs and Algorithm to Find Perimeter of Rhombus

Checkout the following algorithm and program to find or calculate perimeter of rhombus using standard formula, function and pointer in c:

  • Algorithm to Find Perimeter of Rhombus
  • C Program to Find Perimeter of Rhombus using Standard Formula
  • C Program to Find Perimeter of Rhombus using Function
  • C Program to Find Perimeter of Rhombus using Pointer

Algorithm to Find Area of Perimeter

Use the following algorithm to write a program to find the perimeter of the rhombus; as follows:

  1. Take input two side of perimeter of rhombus. Store it in two different variables.
  2. Calculate perimeter of rhombus using area=(d1*d2)/2;
  3. Finally, print the value of Perimeter of rhombus.

C Program to Find Perimeter of Rhombus using Standard Formula

#include<stdio.h>
int main()
{
	float side,perimeter;
	printf("enter side of rhombus: ");
	scanf("%f",&side);
 
	perimeter=4*side;
	printf("Perimeter Of Rhombus: %f\n",perimeter);
	return 0;
}

The output of the above c program; as follows:

enter side of rhombus: 5
Perimeter Of Rhombus: 20.000000

C Program to Find Perimeter of Rhombus using Function

#include<stdio.h>
float perimeter(float s)
{
	return (4*s);
}
 
int main()
{
	float s,p;
	
	printf("enter side of rhombus: ");
	scanf("%f",&s);
	
	p=perimeter(s);
	printf("Perimeter Of Rhombus: %f\n",p);
	return 0;
}

The output of the above c program; as follows:

enter side of rhombus: 8
Perimeter Of Rhombus: 32.000000

C Program to Find Perimeter of Rhombus using Pointer

#include<stdio.h>
void perimeter(float *s,float *p) 
{
	*p=((4)*(*s));
}
 
int main()
{
    
	float s,p;
	
	printf("enter side of rhombus: ");
	scanf("%f",&s);	
 
	perimeter(&s,&p);
	printf("Perimeter Of Rhombus: %f\n",p);
	return 0;
}

The output of the above c program; as follows:

enter side of rhombus: 50
Perimeter Of Rhombus: 200.000000

Recommended C Programs

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *