Program to print table of the numbers from 1 to 10

//Program to print table of the numbers from 1 to 10
#include<stdio.h>
#include<conio.h>
int main()
{
  int row, col;
  clrscr();
  printf("Table of 1 to 10 is as\n");
  for(row=1;row<=10;row++)
  {
    for(col=1;col<=10;col++)
    {
      printf("%4d",row*col);
    }
    printf("\n");
  }
  getch();
  return 0;
}


To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.



Program to print table of given number using for loop

//Program to print table of given number using for loop
#include<stdio.h>
#include<conio.h>
int main()
{
  int n,j,k;
  clrscr();
  printf("Enter a number\n");
  scanf("%d",&n);
  printf("Table of %d is as\n",n);
  for(j=1;j<=10;j++)
  {
    k=n*j;
    printf(" %d \n",k);
  }

  getch();
  return 0;
}


To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.

Program to print table of given number

//Program to print table of given number
#include<stdio.h>
#include<conio.h>
int main()
{
 int n,k=1,m;
 clrscr();
 printf("Enter the number\n");
 scanf("%d",&n);
 while(k<11)
 {
   m=n*k;
   printf("%d*%d=%d\n",n,k,m);
   k++;
 }

  getch();
  return 0;
}


To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.

Program to print sum of digits of the Integer

//Program to print sum of digits of the Integer
#include<stdio.h>
#include<conio.h>
int main()
{
  int n,rem,ans=0;
  clrscr();
  printf("Enter the number\n");
  scanf("%d",&n);
  while(n!=0)
  {
   rem=n%10;
   ans=ans+rem;
   n=n/10;
  }
  printf("The sum of digits is = %d",ans);
  getch();
  return 0;
}


To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.

Program to print table between the given range of integers

//Program to print table between the given range
#include<stdio.h>
#include<conio.h>
int main()
{
  int row, col,y,k;
  clrscr();
  printf("Enter the two numbers for getting the table between their range\n");
  scanf("%d%d",&row,&col);
  k=row;
  printf("Table as\n");
  for(y=1;y<=10;y++)
  {
    for(row;row<=col;row++)
    {
      printf("%4d",row*y);
    }
    row=k;
    printf("\n");
  }
  getch();
  return 0;
}


To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.

Program to accept a number and print its prime factors

//Program to accept a number and print its prime factors
#include<stdio.h>
#include<conio.h>
int main()
{
  int n,k=2,j;
  clrscr();
  printf("Enter the number\n");
  scanf("%d",&n);
  while(k<n)
  {
   if(n%k==0)
   {
     n=n/k;
     printf("%4d",k);
       if(n%k==0)
       printf("%4d",k);
   }
   k++;
  }
  getch();
  return 0;
}


To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.

Program to display prime numbers between 1 to 100

//Program to display prime numbers between 1 to 100
#include<stdio.h>
#include<conio.h>
int main()
{
  int n,j;
  clrscr();
  printf("Prime numbers between 1 to 100\n");
  for(n=3;n<=100;n++)
  {
    for(j=2;j<=100;j++)
    {
     if(n%j==0)
     break;
    }
    if(j==n)
    printf("%4d",n);
  }
  getch();
  return 0;
}


To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.