Learn Computer Programming In Tamil

Breaking

[தமிழில்] HTML & CSS Online Course

[தமிழில்] HTML & CSS Online Course
[தமிழில்] HTML & CSS Online Course

Friday, June 26, 2020

Loop Statements Using C In Tamil


looping statements

கொடுக்கப்பட்ட condition-க்கு ஏற்ப ஒரு குறிப்பிட்ட group of statement-யை திரும்ப execute செய்வதற்கு பயன்படுவது தான் looping statements ஆகும்.
• While statements
• Do..while statements
• For statements


while loop statements

while statements-ல் முதலில் condition-யை check செய்யும். condition true-ஆக இருந்தால் group of statements-களை execute செய்யும்.மறுபிடியும் அதே condition-க்கு சென்று check செய்யப்படும்.அப்பொழுதும் condition true-ஆக இருந்தால் மறுபடியும் group of statements execute செய்யப்படும்.இது மாதிரி condition true-அக இருக்கும் வரை அந்த குறிப்பிட்ட group of statements-கள் execute செய்யப்பட்டு கொண்டிருக்கும்.


 syntax:-
while(condition)
{
statement 1;
statement 2;
}


#include < stdio.h > 
#include < conio.h >
void main()
{
int i;
i=1;
while(i<5);
{
printf("welcome");
i++;
}
getch();
}

output:
welcome
welcome
welcome
welcome


for loop statements:
ஒரு statements அல்லது ஒரு group of statements திரும்ப திரும்ப செயல்படுத்த for statement பயன்படுகின்றது.

 syntax:- 
for(initialization;textcondition;increament/decrement) {
body of the loop;
}
next statement;


#include < stdio.h > 
void main()
{
for(i=0;i<=5;i++)
{
printf("c tutorial");
}
getch();
}
output:
c tutorial
c tutorial
c tutorial
c tutorial
c tutorial


do…while statements
 syntax:-
do
{
body of the loop;
}
while(condition);
next statement;
do…while statements-ல் முதலில் body of the loop-ஆனது execute செய்யப்படும்.அதன் பிறகு,condition-ஆனது check செய்யப்படும்.condition true-ஆன இருந்தால் மறுபடியும் body of the loop-ஆனது execute செய்யப்படும்.இப்படியே,condition false ஆகும் வரை body of the loop-ஆனது execute செய்யப்படும்.condition false ஆகிவிட்டால் control-ஆனது next statement-க்கு சென்று விடும்.


#include < stdio.h > 
void main()
{
int i;
i=1;
do
{
printf("welcome");
i++;
}while(i<5);
getch();
}
output:
welcome
welcome
welcome
welcome

No comments:

Post a Comment