Friday, August 23, 2019

Star Pattern

Star Pattern:


star pattern in cprograms.



*         *
**       **
***    ***
****  ****
*********


#include<stdio.h>
#include<conio.h>

void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<5*2;j++)
{
if(j<=i || j>=5*2-i)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
getch();
}

Star pattern 16 Revers

Star pattern Revers 16:


star pattern in cprograms.



*********
****  ****
***      ***
**          **
*              *


#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,l,m;
clrscr();
l=5;
m=5;

for(i=1;i<=5;i++)
{
for(j=1;j<5*2;j++)
{
if(j>l && j<m)
{
printf(" ");
}
else
{
printf("*");
}
}
l--;
m++;
printf("\n");

}
getch();
}

Star Pattern 15

Star Pattern 15:





          *
        **
      ***
    ****
  *****
******
  *****
    ****
     ***
       **
         *

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k;
clrscr();
for(i=5;i>=-5;i--)
{
for(j=1;j<=abs(i);j++)
{
printf(" ");
}
for(k=5;k>=abs(i);k--)
{
printf("*");
}
printf("\n");
}
getch();
}

Star Pattern Pattern 14

Star Pattern Pattern 14:


Star Pattern Pattern in cprograms.


*
**
***
****
*****
****
***
**
*

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j;
clrscr();
for(i=5;i>=-5;i--)
{
for(j=5;j>abs(i);j--)
{
printf("*");
}
printf("\n");
}
getch();

}

Pascal star Pattern in C language

Pascal star Pattern in C language:


Pascal star Pattern in C language


     *
    * *
   * * *
  * * * *
 * * * * *
 * * * * *
  * * * *
   * * *
    * *
     *   

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k;
clrscr();
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("* ");
}
printf("\n");
}


for(i=5;i>=1;i--)
{
for(j=5;j>=i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("* ");
}
printf("\n");
}
getch();


}

Pyramid Star Pattern Revers in clangauge.

Pyramid Star Pattern Revers in clangauge:


Pyramid Star Pattern Revers in clangauge:


 * * * * *
  * * * *
   * * *
    * *
     * 

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k;
clrscr();
for(i=5;i>=1;i--)
{
for(j=5;j>=i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("* ");
}
printf("\n");
}
getch();


}

Pyramid Star Pattern in c language

Pyramid Star Pattern in c language:

Pyramid Star Pattern in c language:


     *
    * *
   * * *
  * * * *
 * * * * *

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k;
clrscr();
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("* ");
}
printf("\n");
}
getch();


}

Star pattern in Plus Sign

 Star pattern in Plus Sign:

 Star pattern in Plus Sign:


   * 
   *
*****
   * 
   * 

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
if(i==3 ||j==3)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
getch();
}

Pattern 10

Pattern 10:

*   *  * *    *    * *  *   * best excersice in cprograms.



*   *
 * *
  * 
 * *
*   *

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
if(i==j || i+j==5+1)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
getch();
}

hollow Square in c language. Pattern 9

Holo Square:


Holo Square in cprograms.


*****
*      *
*      *
*      *
*****


#include<stdio.h>
#include<conio.h>

void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
if(i==1||j==1||i==5||j==5)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
getch();

}

Tuesday, August 20, 2019

Swapping programs in Function.

Swapping programs in Function:


Swapping programs in Function:


#include<stdio.h>
#include<conio.h>
void swap(int x,int y);
void main()
{
int a=10,b=20;
clrscr();
swap(a,b);
printf("a=%d b=%d\n",a,b);
getch();
}
void swap(int x,int y)
{
int c,a,b;
c=x;
x=y;
y=c;
printf("x=%d y=%d\n",x,y);
}

Output:




Scop rule of function

Scop rule of function:

Scop rule of function


#include<stdio.h>
#include<conio.h>
void scop(int);
void main()
{
int i=20;
clrscr();
scop(i);
getch();
}
void scop(int j)
{
int k=36;
printf("\n%d",j);
printf("\n%d",k);
}

Output:


find a Square in a function. return type of function

Find a Square in a function. return type of function:

Find a Square in a function. return type of function:


#include<stdio.h>
#include<conio.h>
float funret(float);
void main()
{
float i;
clrscr();
printf("Enter a Any Number:- ");
scanf("%f",&i);
funret(i);
getch();
}
float funret(float x)
{
float y;
y=x*x;
printf("The Square is:- %f",y);
return(y);
}

Output:



formal argument is changed in the calling funtion but currosponding chnge does not takeplace in the calling function.

Formal argument is changed in the calling funtion but currosponding chnge does not takeplace in the calling function:

formal argument is changed in the calling funtion but currosponding chnge does not takeplace in the calling function. #include<stdio.h>


#include<stdio.h>
#include<conio.h>
void fun(int);
void main()
{
int a=30;
clrscr();
printf("\nThe Output is:");
fun(a);
printf("\n%d",a);
getch();
}
void fun(int b)
{
b=60;
printf("\n%d",b);

}

Output:

How to sum in function.sending And Receving values between functions..how to pass argument in function.

How to sum in function.sending And Receving values between functions:

how to sum in function.sending And Receving values between functions.


#include<stdio.h>
#include<conio.h>
int sum(int x,int y,int z); //argument
void main()
{
int a,b,c,sum1;
clrscr();
printf("Enter Any Three Numbers:- ");
scanf("%d%d%d",&a,&b,&c);
sum1=sum(a,b,c);
printf("the sum is:- %d",sum1);
getch();
}
int sum(int x,int y,int z)
{
int total;
total=x+y+z;
return(total);
}

Output:


Function called any number of times.

Function called any number of times:

Function called any number of times


#include<stdio.h>
#include<conio.h>
void msg();
void main()
{
clrscr();
msg();  //function call
msg();  //function call
getch();
}
void msg()
{
printf("\nCan't Imagine Without C");
}

Output:


Simple program how to define a function and call.

Simple program of how to define a function:


simple program of how to define a function


#include<stdio.h>
#include<conio.h>
void ahmedabad();
void rajkot();
void bhavnagar();
void main()
{
clrscr();
printf("\nI am in Main");
ahmedabad();
rajkot();
bhavnagar();
getch();
}
void ahmedabad()
{
printf("\nYou are in Ahmedabad");
}
void rajkot()
{
printf("\nYou are in Rajkot");
}
void bhavnagar()
{
printf("\nYou are in Bhavnagar");
}

Output:


Monday, August 19, 2019

simple program how to define function declaration,function call,function defination.

Simple Function Program.


function define,function call,function defination in cprograms.


#include<stdio.h>
#include<conio.h>
void msg(); //function Declaration
void main()
{
clrscr();
msg();      //function call
printf("\n Hii this is Function.");
getch();
}
void msg()       //function definition
{
printf("\n Hello Cprograms.");
}


Output:


Tuesday, August 13, 2019

Print Star triangle

Print Star Triangle:


print star triangle in cprograms.


 *********
  *******
   *****
    ***
     *

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k,l;
clrscr();
for(i=5;i>=1;i--)
{

for(j=5;j>=i;j--)
{
printf("0");
}

for(k=1;k<=2*i-1;k++)
{
printf("*");

}

printf("\n");
}
getch();
}

This Program is mostly asked for interview.

     This Program is mostly asked for interview:


 This Program is mostly asked for interview.


     *
    ***
   *****
  *******
 *********
 *********
  *******
   *****
    ***
     *

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k;
clrscr();
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
printf("0");
}
for(k=1;k<=2*i-1;k++)
{
printf("*");
}
printf("\n");
}
for(i=5;i>=1;i--)
{
for(j=5;j>=i;j--)
{
printf("0");
}
for(k=1;k<=2*i-1;k++)
{
printf("*");
}
printf("\n");
}
getch();
}

Print Star triangle

 Print Star Triangle:


print triangle in cprograms.



     *
    ***
   *****
  *******
 *********

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k,l;
clrscr();
for(i=1;i<=5;i++)
{

for(j=5;j>=i;j--)
{
printf("0");
}

for(k=1;k<=2*i-1;k++)
{
printf("*");

}

printf("\n");
}
getch();
}

Alphabet pattern 12

Alphabet pattern 12:


Alphabet pattern in cprograms.


     A
    CCC
   EEEEE
  GGGGGGG
 IIIIIIIII

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k,l=0;
clrscr();
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
printf(" ");
}
for(k=1;k<=2*i-1;k++)
{
printf("%c",l+65);
}
l=l+2;
printf("\n");
}
getch();
}

Alphabet pattern 11

Alphabet pattern 11:


alphabet pattern in cprograms.

 
       A
    BBB
   CCCCC
  DDDDDDD
 EEEEEEEEE

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k,l=1;
clrscr();
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
printf("0");
}
for(k=1;k<=2*i-1;k++)
{
printf("%c",j+65);
}
l=l+2;
printf("\n");
}
getch();
}

Numeric pattern 10

Numeric pattern 10:

numeric pattern in cprograms.


     1
    333
   55555
  7777777
 999999999


#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k,l=1;
clrscr();
for(i=1;i<=5;i++)
{

for(j=5;j>=i;j--)
{
printf("0");
}
for(k=1;k<=2*i-1;k++)
{
printf("%d",l);
}
l=l+2;
printf("\n");
}
getch();
}

Numeric Pattern 9

 Numeric Pattern 9:

numeric pattern in cprograms


    1
    21
   321
  4321
 54321

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k,l=1;
clrscr();
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
printf("0");
}
for(k=i;k>=1;k--)
{
printf("%d",k);
}
l=l+2;
printf("\n");
}
getch();

}

Numeric pattern is the best prectice.

Numeric pattern is the best prectice:


pyramid pattern in cprograms.


     1
    321
   4321
  7654321
 987654321

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k,l=1;
clrscr();
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
printf(" ");
}
for(k=l;k>=1;k--)
{
printf("%d",k);
}
l=l+2;
printf("\n");
}
getch();

}

Saturday, August 10, 2019

Numeric pattern 7

Numeric pattern 7:


numeric patterns in cprograms



     1
    21
  321
 4321
54321

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=5;j>=1;j--)
{
if(i>=j)
{
printf("%d",j);
}
else
{
printf(" ");
}
}
printf("\n");
}
getch();
}


Numeric pattern 6

Numeric pattern 6:


numeric patterns in cprograms


     1
   22
  333
 4444
55555

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=5;j>=1;j--)
{
if(i>=j)
{
printf("%d",i);
}
else
{
printf(" ");
}
}
printf("\n");
}
getch();
}

Star patterns in cprograms

Star patterns in Cprograms:

star patterns in cprograms




*****
****
***
**
*

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
if(i>=j)
{
printf("*");
}
else if(i<=j)
{
printf("*");
}
}
printf("\n");
}
getch();
}

Star Pattern in cprograms

Star Pattern in Cprograms:

star patterns in cprograms


     *
    **
  ***
 ****
*****


#include<stdio.h>
#include<conio.h>

void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=5;j>=1;j--)
{
if(i>=j)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
getch();
}

Thursday, August 8, 2019

Alphabet pattern 10

Alphabet pattern 10:

alphabet patterns in cprograms.


ABCDE
ABCD
ABC
AB
A


#include<stdio.h>
#include<conio.h>

void main()
{
char i,j;
clrscr();
for(i=4;i>=0;i--)
{
for(j=0;j<=i;j++)
{
printf("%c",j+65);
}
printf("\n");
}
getch();

}

Alphabet pattern 9

Alphabet pattern 9:

alphabet patterns in cprograms.



AAAAA
BBBB
CCC
DD
A

#include<stdio.h>
#include<conio.h>

void main()
{
char i,j;
clrscr();
for(i=0;i<=4;i++)
{
for(j=4;j>=i;j--)
{
printf("%c",i+65);
}
printf("\n");
}
getch();
}

Alphabet Pattern8

Alphabet Pattern8:


alphabet patterns in cprograms



A
AB
ABC
ABCD
ABCDE


#include<stdio.h>
#include<conio.h>

void main()
{
char i,j;
clrscr();
for(i='A';i<='E';i++)
{
for(j='A';j<=i;j++)
{
printf("%c",j);
}
printf("\n");
}
getch();
}

Alphabet Pattern7

Alphabet Pattern7:


alphabet patterns in cprograms.



A
BB
CCC
DDDD
EEEEE

#include<stdio.h>
#include<conio.h>

void main()
{
char i,j;
clrscr();
for(i='A';i<='E';i++)
{
for(j='A';j<=i;j++)
{
printf("%c",i);
}
printf("\n");
}
getch();
}