Powered By Blogger

Thursday 17 January 2013

Constructs Examples (Contd..)

------------
do...while
------------

#include<stdio.h>
using namespace std;
main()
{
 int a;
 do
 {
  printf("Enter a:\n");
        scanf("%d",&a);

 }
 while(a!=2);
}



----------
for loop
----------

#include<stdio.h>
using namespace std;
main()
{

 for(int a=1;a<=5;a++)
 {
  printf("\t \n%d\t\t",a*5);
 }
}



























No comments:

Post a Comment