Showing posts with label print. Show all posts
Showing posts with label print. Show all posts

PRINT PRIME NUMBERS BETWEEN 1-300 USING BREAK AND CONTINUE IN C

How To PRINT PRIME NUMBERS BETWEEN 1-300 USING BREAK AND CONTINUE IN C Program.


#include <math.h>
#include <stdio.h>
main()
{
  int i, j;
  i = 1;
  while ( i < 300 )
  {
            j = 2;
            while ( j < sqrt(i) )
            {
                        if ( i % j == 0 )
                                    break;
                        else
                        {
                                    ++j;
                                    continue;
                        }
            }
   if ( j > sqrt(i) )
            printf("%d\t", i);
    ++i;
  }
  return 0;
}

Write a c program to print Pascal triangle.

How To Write a c program to print Pascal triangle.



#include<stdio.h>
int main(){
  int line,i,j,k;
  printf("Enter the no. of lines");
  scanf("%d",&line);
  for(i=1;i<=line;i++){
      for(j=1;j<=line-i;j++)
           printf(" ");
      for(k=1;k<i;k++)
      printf("%d",k);
      for(k=i;k>=1;k--)
      printf("%d",k);
      printf("\n");
  }
  return 0;
}

C or C++ Program To Print Prime Number

How to write a C or C++ program to print prime number in C Programming Language ?

This Program print first 50 prime number.

To print first 50 prime number

Solution For C Program:

C Program print fill zero & mod/div

How to write a C Program print fill zero & mod/div in C Programming Language ?


Solution For C Program :

C Program to Print a String Without Use Semicolon.

How to write a C Program to Print a String Without Use Semicolon in C Programming Language ?


Solution For C Program :

/*C Program to Print a String Without Use Semicolon.*/

#include <stdio.h>
#include <conio.h>
void main()
{
 if(printf("Hello"))
}

C Program To Input & Print More Than One Words In Single Line

How to write a C Program To Input & Print More Than One Words In Single Line in C Programming Language ?


Solution For C Program :

/*C Program To Input & Print More Than One Words In Single Line.*/

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char s1[50];
int len;
clrscr();
printf("\nEnter the string:");
scanf("%[^\n]",s1);
printf("Output string:%-50s",s1);
len=strlen(s1);
printf("\nlength of the string =%d",len);
getch();
}

You may also learn these C Program/Code :

C Program To Swap Two Numbers Without Using Third Variable

C Program To Print Alphabets Like {Aa Bb Cc...}

How to write a C Program To Print Alphabets Like {Aa Bb Cc...} in C Programming Language ?


Solution For C Program :

/*C Program To Print Alphabets Like {Aa Bb Cc...}.*/

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j=0;
clrscr();
for(i=65;i<=90;i++)
    {
    j=i+32;
    printf("%c%c ",i,j);
    }
getch();
}


OUTPUT :
 Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz


You may also learn these C Program/Code :

C Program To Swap Two Numbers Without Using Third Variable



C Program To Print Alphabets Like {Az By Cx...}

How to write a C Program To Print Alphabets Like {Az By Cx...} in C Programming Language ?


Solution For C Program :

/*C Program To Print Alphabets Like {Az By Cx...}.*/

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j=122;
clrscr();
for(i=65;i<=90;i++)
{
printf("%c%c ",i,j);
j--;
}
getch();
}



OUTPUT :
Az By Cx Dw Ev Fu Gt Hs Ir Jq Kp Lo Mn Nm Ol Pk Qj Ri Sh Tg Uf Ve Wd Xc Yb Za


You may also learn these C Program/Code :

C Program To Swap Two Numbers Without Using Third Variable