Skip to content

Instantly share code, notes, and snippets.

View echo-akash's full-sized avatar
🎯
If you don't fight for what you want, Don't cry for what you lost.

akash poddar echo-akash

🎯
If you don't fight for what you want, Don't cry for what you lost.
View GitHub Profile
@echo-akash
echo-akash / triangle_validity.c
Created August 10, 2017 17:27
Input three angles of triangle and check whether it's valid triangle or not.
#include<stdio.h>
int main()
{
float x,y,z;
printf("enter the three angles:");
scanf("%f%f%f",&x,&y,&z);
if(x+y+z<=180)
printf("triangle is valid");
else
printf("triangle is not valid");
@echo-akash
echo-akash / unit_tenth_print.c
Created August 10, 2017 17:25
Print the unit and tenth place value of a number.
#include<stdio.h>
int main()
{
int n;
printf("enter the number:");
scanf("%d",&n);
printf("unit place:%d",n%10);
printf("\nten's place:%d",(n/10)%10);
return 0;
}
@echo-akash
echo-akash / X_power_N.c
Created August 10, 2017 17:24
Print the value of X^N.
#include<stdio.h>
int main()
{
int p,n,i,x;
p=1;
printf("enter value of X:");
scanf("%d",&x);
printf("enter value of N:");
scanf("%d",&n);
for(i=1;i<=n;i++)
@echo-akash
echo-akash / print_excluding_own.c
Created August 10, 2017 17:23
Print a series of numbers excluding the mentioned number.
#include<stdio.h>
int main()
{
int n,i,x;
printf("enter number range:");
scanf("%d",&n);printf("number to be excluded:");
scanf("%d",&x);
printf("numbers after exclusion:");
for(i=1;i<=n;i++)
{
@echo-akash
echo-akash / multiplication_table.c
Created August 10, 2017 17:21
Print a multiplication table of input number.
#include<stdio.h>
int main()
{
int i,x;
printf("enter :");
scanf("%d",&x);
for(i=1;i<=10;i++)
{
printf("%d*%d=%d\n",x,i,x*i);
}
@echo-akash
echo-akash / Grade_sheet.c
Created August 10, 2017 17:20
Print the mark sheet of the students.
#include<stdio.h>
int main()
{
float n,a[100];
int i;
printf("enter the number of students:");
scanf("%f",&n);
printf("enter the marks of students:");
for(i=0;i<n;i++)
{
@echo-akash
echo-akash / series.c
Created August 10, 2017 17:18
Print the sum of the series: 1*2 + 2*3 + ....... + N*(N+1) = ?
#include<stdio.h>
int main()
{
int i,n,s;
s=0;
printf("enter the range:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("(%d*%d)",i,i+1);
@echo-akash
echo-akash / binary_search.c
Created August 10, 2017 17:10
Search a number from given numbers using binary search method.
#include <stdio.h>
int main()
{
int c, first, last, middle, n, search, array[100];
printf("Enter number of elements\n");
scanf("%d",&n);
printf("Enter %d integers\n", n);
for (c = 0; c < n; c++)
{
scanf("%d",&array[c]);
@echo-akash
echo-akash / series.c
Created August 10, 2017 17:08
Print the sum of the series: 1+1/3+1/5+...+1/N=?
#include<stdio.h>
int main()
{
double n,sum=0,i;
printf("Please Give The Value of N: ");
scanf("%lf",&n);
for(i=1;i<=n;i=i+2)
{
sum = sum + (1/i);
}
@echo-akash
echo-akash / print_positive_negative.c
Created August 10, 2017 17:06
Print the positive and negative numbers from given input.
#include<stdio.h>
int main()
{
int a[100],p[100],ne[100],i,j,n,k,m,f1,f2;
k=0;
m=0;
f1=0;
f2=0;
printf("enter the number of numbers:");
scanf("%d",&n);