13) Sample C Program to accept a number and print mathematical table of the given no.
# include <stdio.h>
# include <conio.h>
main( )
{
int i, t;
clrscr( );
printf("Which table you want:");
scanf("%d",&t);
for (i = 1; i <= 10; i++)
printf("\n%d * %d = %d", t, i, i * t);
getch( );
}
14) Sample C Program to print 1 to 10 mathematical tables.
# include <stdio.h>
# include <conio.h>
main( )
{
int i, j;
clrscr( );
for (i = 1; i <= 10; i++)
for (j = 1; j <= 10; j++)
printf("\n%d * %d = %d", i, j, i * j);
getch( );
}
15) Sample C Program to print Fibonacci series.
# include <stdio.h>
# include <conio.h>
main( )
{
int a = 0, b = 1, c = 0, i;
clrscr( );
printf("%d",a);
printf("\n%d",b);
for (i = 1; i <= 10; i++)
{
c = a + b;
printf("\n%d", c);
a = b;
b = c;
}
getch( );
}
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com