Monday, 10 October 2011

to print 1,13,135,1357,13579


#include<stdio.h>
#include<conio.h>
main()
{
int i,j;
clrscr();
for(i=1;i<=9;i++)
{
printf("\n");
for(j=1;j<=i;j=j+2)
{
printf("%d",j);
}
}
getch();
return 0;
}         //output
1                                                                              
1                                                                              
13                                                                            
13                                                                            
135                                                                            
135                                                                            
1357                                                                          
1357                                                                          
13579                                                                          
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               

2 comments: