Thursday, 1 December 2016

WRITE YOUR QUESTION RELATED IN C

Wednesday, 30 November 2016

AREA OF TRIANLGE



#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i;
float a,b,c,area,s,l,m;
printf("enter 1 for using Heron's formula 2 for general formula\n");
scanf("%d",&i);
switch(i)
{
case 1:
    printf("enter the value of three sides of the triangle\n");
    scanf("%f%f%f",&a,&b,&c);
    s=(a+b+c)/2;
    area=sqrt(s*(s-a)*(s-b)*(s-c));
    printf("AREA OF TRIANGLE=%f",area);
    break;
case 2:
    printf("enter the base and height of the triangle\n");
    scanf("%f%f",&l,&m);
    area=(0.5)*l*m;
    printf("area of the triangle is %f", area);
    break;
default:
    printf("SEE YOU SOON\n BYE");
    break;
}

}

AREA OF TRIANGLE


#include<stdio.h>
#include<conio.h>
int fact(int);
int b,p;
void main()
{
printf("enter a number\n");
scanf("%d",&b);
fact(b);
printf("factorial of %d is %d",b,p);
getch();
}
int fact(int b)
{
    if(b==0)
        return(1);
    else
p=b*fact(b-1);
return(p);
}

REVERSE TRIANGLE


#include<stdio.h>
#include<conio.h>
void main()
{

    int i,j,k;
    for(i=0;i<10;i++)
    {
        for(k=0;k<i;k++)
        {
            printf(" ");
        }
        for(j=10;j>2*i;j--)
        {
            printf("*");
        }
        printf("\n");

    }
}

FIBONACCI USING C




#include<stdio.h>
#include<conio.h>
void fib();
void main()
{
    fib();

}
void fib()
{

    int a=0,b=1,c=0,i,n;
  printf("enter the range\n");
  scanf("%d",&n);
printf("%d\n",c);
  for(i=0;i<n-1;i++)
  {
  c=b+a;
  b=a;
  a=c;

   printf("%d\n",c);
   }
}

SUM HARMONIC SERIES IN C



#include<stdio.h>
#include<conio.h>
void main()
{
float i,k;
float sum=0.0;
printf("please enter the value of n\n");
scanf("%f",&k);
for(i=1;i<=k;i++)
{
sum=sum+(1/(i));
}
printf("sum=%f",sum);
}

READ STRING


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[6][12]={"nitin","anurag","satlaj","ashish","charu","kislay"};
char name[12];
int i,b;
printf("enter your name\n");
scanf("%s",name);
for(i=0;i<6;i++)
{
 b=strcmp(name,&a[i][0]);
 if(b==0)
        printf("your entry is leagal\n");


}

}

USE MICRO IN C


#include<stdio.h>
#include<conio.h>
#define area(n) (n*n)
void main()
{
int s,sq;
printf("enter the side of square\n");
scanf("%d",&s);
sq=area(s);
printf("%d",sq);
}

MAKE A HOUSE IN C


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,a,b,c,t,m;
printf("\n\n\t\t");
for(i=0;i<20;i++)
{
printf("* ");
}
printf("\n");
for(j=0;j<15;j++)
{
    for(a=15;a>=j;a--)
    {
        printf(" ");
    }
    printf("*");
    for(k=0;k<2*j;k++)
    {
        printf(" ");
    }
    printf("*                                     *");
    printf("\n");
}
for(b=0;b<36;b++)
{
    printf("* ");
}
printf("\n");
for(c=0;c<15;c++)
{
    printf("*                               *                                     *\n");
}
for(t=0;t<5;t++)
{
    printf("*            ||||               *                                     *\n");
}
for(m=0;m<36;m++)
{
    printf("* ");
}
getch();
}

STAR A ND TRIANGLE USING C


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
for(i=10;i>0;i--)
{
for(j=2;j<=2*i;j++)
{
printf("*");
}
printf("\n");
for(k=10;k>=i;k--)
{
printf(" ");
}
}
}

Monday, 28 November 2016

1.   write a C program to print a triangle.
*
**
***
****
*****
solution:

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a;
printf("enter the any number to print a triangle\n\t");
scanf("%d",&a);
for(i=0;i<a;i++)
{
for(j=0;j<=i;j++)
{
printf("*");
}
printf("\n");
}
getch();

}

Sunday, 27 November 2016

CREATING A LOGIN PROGRAM USING C


#include<stdio.h>
#include<conio.h>
#include<string.h>
void login();
char user1[12]={"nitinmkesh"};
char pass1[15]={"12345nm"};
char city1[6]={"patna"};
void main()
{
login();
}
void login()
{
char user[15];
char pass[15];
char city[10];
int a,b,c,i;
printf("enter your username\n");
scanf("%s",user);
a=strcmp(user,user1);
if(a==0)
{
printf("welcome please enter your password\n");
scanf("%s",pass);
b=strcmp(pass,pass1);
if(b==0)
{
printf("welcome Dudes\n you have got the access to our program\n");
}
else
{
printf("your password is inncorret\n invalid selection\n");
printf("1.password recovery\n2.another login\n3.exit\n");
scanf("%d",&i);
switch(i)
{
case 1:
printf("enter name of your city\n");
scanf("%s",city);
c=strcmp(city,city1);
if(c==0)
{
printf("your password for username %s  is  %s\n",user1,pass1);
printf("you are being directed to login portal\n");
login();
}
else
{
printf("sorry dudes\n");
}
break;
case 2:
login();
break;
case 3:
break;
}
}
}
else
{
    printf("your username is not correct\n BYE");
}
}

Saturday, 26 November 2016

SINE SEREIS BY C PROGRAMMIG LANGUAGE


#include<stdio.h>
#include<conio.h>
#define pi 3.14
void main()
{
int i,p;
float temp,ar,ad,sum;
printf("enter the angle in degree\n");
scanf("%f",&ad);
printf("enter the number of terms upto which you want to calculate the sum\n");
scanf("%d",&p);
ar=ad*(pi/180.0);
temp=ar;
printf("%f\n",ar);
sum=ar;
for(i=2;i<=2*p;i=i+2)
{
temp=(temp*(-1)*ar*ar)/(i*(i+1));
sum=sum+temp;
}
printf("sin(%f)= %f",ar,sum);
getch();
}

Wednesday, 9 November 2016

THIS IS A PROGRAM TO FIND FACTORIAL


#include<stdio.h>
#include<conio.h>
void main()
{
int i,fact=1,a;
printf("please enter a number to find its factorial\n");
scanf("%d",&a);
for(i=1;i<=a;i++)
{
fact=fact*i;
}
printf("factorial of %d is %d",a,fact);
getch();
}


नितिन मुकेश  के द्वारा प्रकाशित 

programming: THIS IS THE PROGRAMMING TUTORIAL AND THIS IS A PRO...

programming: THIS IS THE PROGRAMMING TUTORIAL AND THIS IS A PRO...: THIS IS THE PROGRAMMING TUTORIAL AND THIS IS A PROGRAM OF EXPONENTIAL SERIES #include<stdio.h> #include<conio.h> void main(...
THIS IS THE PROGRAMMING TUTORIAL AND THIS IS A PROGRAM OF EXPONENTIAL SERIES

#include<stdio.h>
#include<conio.h>
void main()
{
int p,i;
float x,sum=1,k=0,final;
printf("enter a number\n");
scanf("%f",&x);
printf("enter the number the terms of to find exponential");
scanf("%d",&p);
for(i=1;i<=4*p;i++)
{
sum=(sum*x)/i;
k=k+sum;
}
final=1+k;
printf("%f",final);
getch();
}