Menu

Pattern Program in C


Pattern Program in C.

Hello student here you will learn about “Number Pattern Program”  in briefly. Pattern Program in C

write a pattern Program in C Using For Loop().
write a Program in C and print Number in reverse order.

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

void main()
{
int i,c=0;
clrscr();
printf(“\n enter a number:-“);
scanf(” %d”,&i);

for(;i>=0;i–)
{
c=i;
printf(“\n”);
for(;;)
{
printf(“%d”,c);
if(c==0)
break;
c–;
}
}
getch();

}

Output:-
Pattern Program in C
Run Time:- Pattern Program in C Result:- Pattern Program in C

Main Point for This Program?

#include :- That we know in every program we are using #include that is Preprocessor.

<stdio.h> :- It is a Header File whose extension is .h ‘or’ Standard Input/Output.

<conio.h> :- conio stands for Console Input/Output. It is also a header file, we use it for Clear Output.

void main() :- Main is a function and It is execute a C program. Only one main function must be Present in a C program file.

{ } :- we use it for separate the Particular Block.

Int (Datatype):- It is a Datatype, which storage capacity is 2 Bytes.

I,C (Variable):- Variable must be declare before using then in the declaration portion of C program. Variable can be declare as Local ‘or’ Global Variable’s.
Ex. Var1,Var2….VarN; or Int a,b,c; (Here you can also put value in these Variable like Int a,b,c=5)

; (Semicolon):- It is also a important part of every C program. Because, in C program every statement is terminated by Semicolon.

Note:- Here escape sequence ‘/n’ is used to move the cursor in output window.

 

Necessary Topics.

Q. Why use clrscr(); ?
Ans:- clrscr(); stands for Clear Screen, in every C program we can use this function for clear the output screen. we attach it bottom of <Data type section> & top of printf(); or scanf(); .

printf(); :- In C it’s provides function ‘printf(); to Display output on Monitor.

scanf(); :-‘C’ provides function scanf(); for reading the value.
scanf(“%d”,&i); (Here %d is Conversion Character of Integer Datatype & i is variable).

For() :- It is a loop. A loop is also called interaction to execute set of statement at the number of times. In this loop the control of C program initialize a counter variable by a value. After that, it goes to check the given condition. If the value of condition will be true, it execute all those statements written within the block of for() loop after that is goes to increase or decrease the value of a counter variable and again it goes to check the given condition the value of condition will be true again. It goes to execute the block of for() loop. The above task accept initialization is done repeatedly fill the value of condition will be true and when the value of condition will be false the control of C program exit from the for() loop.

If( ) :- This is conditional statement which gives a condition. Those control statement which are use to transfer the control of C program from One Position to another Position according to the value of condition. That is called Conditional Statement ‘or’ Conditional Control Statement

Break ; :- Break keyword that is used to terminate the execution of Switch-Case statement as well as any type of loop.

C– (Postfix Decrements Operator) :- When a Decrements operator – – is written after a variable name, then it is called Post-fix Decrements Operator. Due to the use of Post-fix Decrements Operator in a statement ‘or’ an Expression then execution will be at 1st and Decentralization at Last.

Why use getch(); in c program?
Ans:-It is Input statement function, which are used to input data from the Keyboard/File and store the supplied data into variables are called Input statement/Function. In C program if you will use header file as <conio.h> then you have to necessary to use getch(); or return 0; if any case you don’t use this , then our compiler can not understand what to do, Because header file <conio.h> , conio stands for Console Input/Output so the C compiler will confused.

Hello Dear i hope you will enjoy this Article, Pattern Program in C if you want learn more Briefly then you can Read this Article Visit again.

Thank You

 

 

Pattern Program in C

Hello student here you will learn about "Number Pattern Program"  in briefly. Pattern Program in C

Course Provider: Organization


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

T H E S M O L T Learn For Free Download Our Android App in Free DOWNLOAD
+