C language program
- 1. 1.) /* HELLO.C -- Hello, world */
#include <stdio.h>
main()
{
printf("Hello, worldn");
}
2.) #include<stdio.h>
#include<conio.h>
void main()
{
char ch;
clrscr();
Printf("press any key n");
Scanf("%c", &ch);
Printf("ASCII value is %d", ch);
getch();
}
3.)
#include<stdio.h>
#include<conio.h>
void main()
- 2. {
char ch;
clrscr();
printf("press any key n");
scanf("%c",&ch);
printf("ASCII value is %d",ch);
getch();
}
4.)
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,max;
clrscr();
printf("enter three values",3);
scanf("%d %d %d",&a,&b,&c);
max=(a>b)?(a>c)?(a:c):(b>c)?(b:c);
printf("largest no is %dn",max);
getch();
}
5.)
#include<stdio.h>
- 3. #include<conio.h>
main()
{
int a,b,max;
clrscr();
a=8;
b=5;
max=(a>b?a:b);
printf("%d n",a);
printf("%d n",b);
printf("Largest no=%d n",max);
getch();
}
6.)
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,max;
clrscr();
printf("enter three values",3);
scanf("%d %d %d",&a,&b,&c);
max=(a>b)?(a>c)?(a:c):(b>c)?(b:c);
- 4. printf("largest no is %dn",max);
getch();
}
7.)
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float r,v;
clrscr();
prinftf("enter radiusn");
scanf("%f",&r);
v=4.0/3* 3.14159*pow(r,3);
printf("volume=%fn",v);
getch();
}
8.)
#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
- 5. clrscr();
printf("ASCII values are %d",ch);
printf("print value a");
getch();
}
9.)
#include<stdio.h>
#include<conio.h>
main()
{
int num;
clrscr();
printf("enter any number");
scanf("%d",&num);
if(num>=0)
printf("positive");
else
printf("negative");
getch();
}
10.) #include<stdio.h>
#include<conio.h>
main()