WRITE YOUR QUESTION RELATED IN C
programming
Thursday, 1 December 2016
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;
}
}
#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;
}
}
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");
}
}
#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");
}
}
Subscribe to:
Comments (Atom)