Saturday 1 October 2016

FOR LOOP IN C| LEARN C

CODINGCLASSES|LEARNTOPROGRAM


learn C Programming

FOR LOOP IN C

E.G-

#include<stdio.h>
#include<conio.h>
void main()
{
int i,n;
printf("Enter the number From own wish ");
Scanf("%d", n);
For(i=0; i<n;  i++)
{
printf("%d", i); }
getch();}

This program is already checked in Turbo c++ no any compile time and run time error 

O/P-ENter the number From own wish
 n=2
0,1

                                            or
#include<stdio.h>
#include<conio.h>
void Forloop()
{
int i,n;
printf("Enter teh nuber ");
Scanf(" %d ",n);
For(i=0; i<n; i++)
{
printf("%d ", i);
}

}
void main()
{
Forloop();
getch();
}

o/p:-
Enter the number
n=5
0,1,2,3,4

No comments:

Post a Comment