Basic C programs
DEMO PROGRAMS
Program:1
#include
#include
void
main()
{
clrscr()
printf(“welcome
to techcorner computer centre”);>
getch();
}
output:
welcome
to techcorner computer centre
program:2
#include
#include
void main()
{
char name[20];
int age;
float height;
clrscr();
printf(“enter ur name\n”);
scanf(“%s”,&name);
printf(“enter ur age\n”);
scanf(“%d”,&age)
printf(“enter ur height\n”);
scanf(“%f”,&height);
printf(“name :%s”,name);
printf(“age :%d”,age);
printf(“height :%f”,height);
getch();
}
OUTPUT:
Enter ur Name
Uma
Enter ur Age
20
Enter ur Height
6.2
Name : Uma
Age : 20
Height :6.2
ARITHMETIC FUNCTIONS
Program:3
#include
#include
void main()
{
int a,b,c,tot;
clrscr();
printf(“enter a value\n”);
scanf(“%d”,&a);
printf(“enter b value\n”);
scanf(“%d”,&b);
printf(“enter c value\n”);
scanf(“%d”,&c);
tot=a+b+c;
printf(“total
%d”,tot);
getch();
}
OUTPUT:
Enter a value
50
Enter b value
30
Enter c value
20
Total:100
No comments:
Post a Comment