Computer Science Studies (BIT)
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Computer Science Studies (BIT)

This fourm is created by Sir Muhammad Tahir Farooq. The purpose of creating this fourm to share information the students.
 
HomeHome  Latest imagesLatest images  RegisterRegister  Log inLog in  
Aslam-O-Alikum!
Search
 
 

Display results as :
 
Rechercher Advanced Search
Calender
Latest topics
» Chapter #1 Complete MCQ's (PART-1)
LOOP Complete Topic EmptyTue Feb 24, 2015 6:00 am by Shaheer

» Windows Operating System (COMPLETE)
LOOP Complete Topic EmptyMon Jan 26, 2015 10:17 am by shaista

» Computer Architecture (COMPLETE)
LOOP Complete Topic EmptySun Jan 25, 2015 5:52 am by shaista

» A virus that create more folders in your computer
LOOP Complete Topic EmptyTue Jan 06, 2015 3:49 am by tahir48

» Browsers Comparision
LOOP Complete Topic EmptyTue Jan 06, 2015 3:39 am by tahir48

» WEb to PDF convert
LOOP Complete Topic EmptySun Jan 04, 2015 7:34 am by shaista

» 7th Class Computer paper 1st 2 Chapters
LOOP Complete Topic EmptyMon Dec 08, 2014 6:21 pm by shaista

» 8th Class Computer Paper 1st 2 chapters
LOOP Complete Topic EmptyMon Dec 08, 2014 6:16 pm by shaista

» Chapter # 1 9th Class
LOOP Complete Topic EmptyMon Dec 08, 2014 2:52 am by shaista

Poll
Top posters
Admin
LOOP Complete Topic Vote_lcapLOOP Complete Topic Voting_barLOOP Complete Topic Vote_rcap 
shaista
LOOP Complete Topic Vote_lcapLOOP Complete Topic Voting_barLOOP Complete Topic Vote_rcap 
tahir48
LOOP Complete Topic Vote_lcapLOOP Complete Topic Voting_barLOOP Complete Topic Vote_rcap 
computerstudent18
LOOP Complete Topic Vote_lcapLOOP Complete Topic Voting_barLOOP Complete Topic Vote_rcap 
computerstudent29
LOOP Complete Topic Vote_lcapLOOP Complete Topic Voting_barLOOP Complete Topic Vote_rcap 
thompson john
LOOP Complete Topic Vote_lcapLOOP Complete Topic Voting_barLOOP Complete Topic Vote_rcap 
Shaheer
LOOP Complete Topic Vote_lcapLOOP Complete Topic Voting_barLOOP Complete Topic Vote_rcap 
Statistics
We have 31 registered users
The newest registered user is Esha

Our users have posted a total of 214 messages in 210 subjects
Flag Counter
LOOP Complete Topic Flags_1

 

 LOOP Complete Topic

Go down 
AuthorMessage
Admin
Admin
Admin
Admin


Posts : 114
Join date : 2012-10-29
Location : Lahore Pakistan

LOOP Complete Topic Empty
PostSubject: LOOP Complete Topic   LOOP Complete Topic EmptyMon Sep 16, 2013 7:05 pm

Q: what is loop? Ans: A statement or set of statements that is executed repeatedly is known as loop, or iteration. There are three types of loops available in C language.
1.       For Loop
i)        Counter loop
2.       Conditional Loop
ii)       While loop
iii)     do-while loop
Q: What is “while” loop? Ans: while loop is the simplest loop of C language. This loop executes one or more statements while the given condition remains true. Syntax:  While(condition)              statement;
The syntax of compound statement as :
While (condition)
{
Statement 1;
Statement 2;
:
Statement N;                                                       LOOP Complete Topic C:\DOCUME~1\MOD\LOCALS~1\Temp\msohtmlclip1\01\clip_image002
}
ü  write a program that displays “Pakistan” for five times using while loop.(int n; n=1; while(n<=5); n++; and \n).
ü  write a program that displays counting from 1 to 10. (int n; while(condition) n++Wink
ü  write a program that displays first five numbers and their sum using while loop.(int c,sum; sum=0 while(condition) sum=sum+c;)
ü  write a program that displays first 5 numbers with their squares using while loop.(n=1;, while(n<=5), printf(“%d %d\n”,n,n*n);, n++Wink
ü  write a program that inputs a number from the user and displays the factorial of that number using while loop.
LOOP Complete Topic C:\DOCUME~1\MOD\LOCALS~1\Temp\msohtmlclip1\01\clip_image004LOOP Complete Topic C:\DOCUME~1\MOD\LOCALS~1\Temp\msohtmlclip1\01\clip_image005LOOP Complete Topic C:\DOCUME~1\MOD\LOCALS~1\Temp\msohtmlclip1\01\clip_image006                                                                                                                                                                                     


 
ü  What is do-while loop? The do-while is an iterative control in  c language. This loop execute one or more statements while the given condition is true. In this loop, the condition comes after the body of loop. The loop is important in a situation where a statement must be executed at least once.
Syntax:  do
                {
                                Statement 1;
                                Statement 2;
                                :
                                :
                                Statement N;
                }
                While (condition);
ü  What is difference b/w while and do-while loops?
While loop:Y in while loop, conditions comes before the body of the loop. Y if condition is false in the beginning, while loop is never executed. Y the semicolon is not used after the condition.
do-while loop: Y in do-while loop, condition comes after the body of the loop. Y do-while is executed at least once even if conditions is false in the beginning. Y semicolon is used after the condition.
LOOP Complete Topic C:\DOCUME~1\MOD\LOCALS~1\Temp\msohtmlclip1\01\clip_image007LOOP Complete Topic C:\DOCUME~1\MOD\LOCALS~1\Temp\msohtmlclip1\01\clip_image008Program: write a program that displays first ten odd numbers using do-while loop.
                                                                                                                                                                                                                                                                                                                                                                                                                              
 
                                                                                                                                                                                   


LOOP Complete Topic C:\DOCUME~1\MOD\LOCALS~1\Temp\msohtmlclip1\01\clip_image009 
Back to top Go down
https://computerstudies.forumotion.com
 
LOOP Complete Topic
Back to top 
Page 1 of 1
 Similar topics
-
» 10th Class: Chapter # 1 Complete Paper (Complete) (IN Urdu)
» First Topic of Ch # 1 (History of Computer)
» Ages of Computers (Very Important Topic)
» Chapter #1 Complete MCQ's (PART-1)
» Chapter #1 Complete MCQ's (PART-2)

Permissions in this forum:You cannot reply to topics in this forum
Computer Science Studies (BIT) :: Classes :: Second Year Standard-
Jump to: