Sunday, 13 September 2015

C PROGRAMMING --TABLE OF A NO.

USING FUNCTION

#include<stdio.h>
#include<conio.h>
void table(int);
void main()
{ clrscr();
int n;
printf("enter the no.=");
scanf("%d",&n);
table(n);
getch();
}
void table(int x)
{ int i,t;
for(i=1;i<=10;i++)
{ t=x*i;
printf("%d\n",t);

}
}

WITHOUT USING FUNCTION

#include<stdio.h>
#include<conio.h>
void main()
{ int i,n;
clrscr();
printf("enter the no.=");
scanf("%d",&n);
for(i=n;i<=(n*10);i=i+n)
{ printf("%d\n",i);
}
getch();

}

No comments:

Post a Comment