Saturday, April 8, 2017

Swastik Pattern 2

Following program will print Swastik pattern based on given value of N.



#include<stdio.h>
int main()
{
int i,j,n;
printf("Enter Swastik Size(n):");
scanf("%d",&n);
printf("** ");

for(i=0; i<n-2; i++)
printf("   ");

for(i=0; i<n; i++)
printf("** ");

printf("\n");
printf("** ");

for(i=0; i<n-2; i++)
printf("   ");

for(i=0; i<n; i++)
printf("** ");

printf("\n");
for(j=0; j<n-2; j++)
{
printf("** ");
for(i=0; i<n-2; i++)
printf("   ");
printf("** \n");
}

for(i=0; i<n*2-1; i++)
printf("** ");
printf("\n");
for(i=0; i<n*2-1; i++)
printf("** ");
printf("\n");

for(j=0; j<n-2; j++)
{
for(i=0; i<=n-2; i++)
printf("   ");
printf("** ");
for(i=0; i<n-2; i++)
printf("   ");
printf("** \n");
}

for(i=0; i<n; i++)
printf("** ");
for(i=0; i<n-2; i++)
printf("   ");
printf("** \n");
for(i=0; i<n; i++)
printf("** ");
for(i=0; i<n-2; i++)
printf("   ");
printf("** ");
        return 0;
}

Output of program

Enter Swastik Size(n):5
**          ** ** ** ** **
**          ** ** ** ** **
**          **
**          **
**          **
** ** ** ** ** ** ** ** **
** ** ** ** ** ** ** ** **
            **          **
            **          **
            **          **
** ** ** ** **          **
** ** ** ** **          **

Tuesday, April 4, 2017

Flowchart to subtract two numbers.


Flowchart to subtract two numbers

Flowchart to subtract two numbers

Fig. Flowchart to subtract two numbers

Flowchart to Add two numbers.

Flowchart to Add two numbers 

This flowchart outlines the essential steps required to add two numbers.

Flowchart to add two numbers

Fig. Flowchart to Add two numbers


Top 10 Flowchart Examples on 


youtube.com/@SelfStudyTutorials
 




< Home Page >


Flowchart to print area of square.

Flowchart to print area of rectangle.


Flowchart to Print Area of Rectangle

Flowchart to print area of rectangle


Fig. Flowchart to print Area of Rectangle

Key Symbols used in this flowchart are:

  • Oval: Represents the start and end points of the flowchart.
  • Parallelogram: Used for input and output operations.
  • Rectangle: Denotes processes or calculations.
  • Arrows: Show the flow of control and data between steps.

Back to Flowchart Page

Sunday, April 2, 2017

Escape Sequences

Followings are some of the escape sequences characters used in C language.

Escape Sequence
Characters
Description
Example
Output
\n
New line
printf(“Hello \n Student”);
Hello
Student
\t
Tab
printf(“Hello \t Student”);
Hello     Student
\a
Alert (Beep) sound
printf(“\a”);
You will listen a Beep sound
\0
Null
printf(“Hello \0 World”);
Hello
\r
Carriage return
printf("Gujarat\rINDIA");
INDIAat
\"
To insert double quote
printf("\"INDIA\"");
"INDIA"
\'
To insert single quote
printf("Gujarat\'s");
Gujarat's
\\
To print \
printf("On\\Off");
On\Off







Saturday, April 1, 2017

Reserved Words (Keywords) in C

                 
auto
break
case
char
const
continue
default
do
double
else
enum
extern
float
for
goto
if
int
long
register
return
short
signed
sizeof
static
struct
switch
typedef
union
unsigned
void
volatile
while

Important points to remember
  • C is case sensitive.
  • All keywords and Standard Library functions are in lowercase.
  • These reserved keywords cann’t be used as variable or function name of C program.