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 / 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);
@echo-akash
echo-akash / rectangle_perimeter.c
Created August 10, 2017 17:04
Input the height and base pf rectangle and print the perimeter.
#include <stdio.h>
#include <math.h>
int main()
{
float h,b,p;
printf("Enter the values of two sides:");
scanf("%f %f",&b,&h);
p = (b+h)*2;
printf("perimeter of a rectangle = %f", p);
return 0;
@echo-akash
echo-akash / rectangle_area.c
Created August 10, 2017 17:02
Input the base and height of rectangle and print the area.
#include <stdio.h>
#include <math.h>
void main()
{
float h,b,area;
printf("Enter the values base and height:");
scanf("%f %f",&b,&h);
area = (b*h);
printf("Area of a rectangle = %f", area);
return 0;