Program 1
#include
#include
void main()
{
char name[12];
int i;
clrscr();
printf("Enter the name");
scanf("%s",name);
for(i=0;i<6 i="" span="">6>
{
printf("%d. Hello
%s\n",I,name);
}
getch();
}
Output
Enter the name
Raja
1.
Hello Raja
2.
Hello Raja
3.
Hello Raja
4.
Hello Raja
5.
Hello Raja
6.
Hello Raja
Program 2
#include
#include
void main()
{
int marks,tot=0,i,n;
float avg;
clrscr();
printf("Enter how many subject
marks");
scanf("%d",&n);
for(i=0;i
{
printf("Enter the mark:");
scanf("%d",&n);
tot=tot+mark;
}
avg=tot/n;
printf("\n The total value :%d\n",tot);
printf("\n The average value :%f",avg);
getch();
}
Output
Enter how many subject marks
2
Enter
the mark: 90
Enter
the mark :60
The
total value : 150
The
average value : 75
Program 3
#include
#include
void main()
{
int i,m1,m2,m3;
clrscr();
for(i=1;i<=10;i++)
{
m1=i*5;
printf("%2d*5=%2d\t",i,m1);
m2=i*6;
printf("%2d*6=%2d\t",i,m2);
m3=i*7;
printf("%2d*7=%2d\t",i,m3);
printf("\n");
}
getch();
}
Output
1*5=5 1*6=6 1*7=7
2*5=10 2*6=12 2*7=14
3*5=15 3*6=18 3*7=21
4*5=20 4*6=24 4*7=28
5*5=25 5*6=30 5*7=35
6*5=30 6*6=36 6*7=42
7*5=35 7*6=42 7*7=49
8*5=40 8*6=48 8*7=56
9*5=45 9*6=54 9*7=63
10*5=50 10*6=60 10*7=70
No comments:
Post a Comment