Archive Pages Design$type=blogging

How to write a program in C using for Loop?

For loop is the most popular looping structure in C programming language . It does required number of repetitions for the execution of block...


For loop is the most popular looping structure in C programming language. It does required number of repetitions for the execution of block of codes. The For Loop allows us to specify three things about a loop in a single line, which are initialise counter, test counter and increment counter. Initialise counter sets a loop counter to an initial value, test counter test the loop counter to determine whether it's value has reached the number of repetitions desired and increment counter increase the value of loop counter each time the program segment within the loop has been executed. Here I have illustrated How to write a program in C using for Loop.

The general form of for statement is as follows.


for(initialise counter; test counter; increment counter)
{
block of codes
}


The diagram for the for loop is as follows.

write a program in C using for Loop
For-Loop

For example following is the program code in C to calculate simple interest. 


/*calculation of simple interest for 3 sets of p,n and r */
#include <stdio.h>
 int main()
{
int p,n,count;
float r,si;
for(count=1; count<=3; count=count+1)
 {
 printf("Enter values of p,n and r");
 scanf("%d %d%f", &p,&n,&r);
 si=p*n*r/100;
printf(simple interest=%f\n",si);
 }
 return 0;
 }


You can view the following other posts

تعليقات

الاسم

Artificial Intelligence(AI) Backlinking Basic IT Best List Blogging Tips C C# C++ Computer Architecture Computer Fundamental Computer Security Computer/IT Officer Exam CSS Data Mining and Warehousing Data Recovery Tools Data Structure Database Management System E-commerce E-government Internet & Web Designing IT Law IT Tips and Tricks IT Tutorials Java JavaScript Keyword Research Tools MIS Multiple Choice Question (MCQ) Networking Online Earning Online IT Jobs Operating System Oracle Forms and Reports Programming Guide Programming Language SEO Social Networking Sites Software Download Software Engineering System Analysis and Design Top List VB.Net
false
rtl
item
Max5: How to write a program in C using for Loop?
How to write a program in C using for Loop?
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL7dDXM4szxns4L_pRLnPl9XpB750dMeuvEVTZXRqpRpnEk6OL52Ou1pheGXc0gB_O0ar0l1wGnY73gz2VS4PGmlqDBuE4Nff5BC2F88JCVNVkov3TjpIdt_Sen8ZO3yh1-DnlU3YyGZK_/s400/for-loop.JPG
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL7dDXM4szxns4L_pRLnPl9XpB750dMeuvEVTZXRqpRpnEk6OL52Ou1pheGXc0gB_O0ar0l1wGnY73gz2VS4PGmlqDBuE4Nff5BC2F88JCVNVkov3TjpIdt_Sen8ZO3yh1-DnlU3YyGZK_/s72-c/for-loop.JPG
Max5
https://maxs27.blogspot.com/2013/04/how-to-write-program-in-c-using-for-loop.html
https://maxs27.blogspot.com/
http://maxs27.blogspot.com/
http://maxs27.blogspot.com/2013/04/how-to-write-program-in-c-using-for-loop.html
true
1760660989564394152
UTF-8
لم يتم العثور على اى مواضيع شاهد الكل اقرأ المزيد رد احذف الرد حذف بواسطة الرئيسية صفحات مواضيع شاهد الكل نوصى لك التسميات الارشيف بحث لم يتم العثور على ماتبحث عنه عودة للرئيسية الاحد الاثنين الثلاثاء الاربعاء الخميس الجمعة السبت الاحد الاثنين الثلاثاء الاربعاء الخميس الجمعة السبت يناير فبراير مارس ابريل مايو يونيو يوليو اغسطس سبتمبر اكتوبر نوفمبر ديسمبر يناير فبراير مارس ابريل مايو يونيو يوليو اغسطس سبتمبر اكتوبر نوفمبر ديسمبر just now 1 دقيقة مضت $$1$$ دقيقة مضت 1 hour ago $$1$$ ساعة مضت الامس $$1$$ يوم مضى $$1$$ اسبوع مضى اكثر من 5 اسابيع مضت