Thursday, December 26, 2013

C Programs

To See Source Code of All 'C' Programs
Click Here
http://c-programs-database.blogspot.in/

for all programs 

See  "BLOG ARCHIVE-LIST OF PROGRAMS" 

(AT RIGHT SIDE OF PAGE)

Friday, December 13, 2013

Write a C program to print the following star program. Also write down the algorithm

#include<stdio.h>
#include<conio.h>
int main()
{
 int num,r,c;
 printf("Enter loop repeat number(rows): ");
 scanf("%d",&num);
 for(r=1; r<=num; r++)
 {
  for(c=1; c<=r; c++)
     printf("*");
  printf("\n");
 }
 getch();
 return 0;


Output

*
**
***
****
*****

step1: num<--0, r<--0, c<--0
step2: Read number num
step3: Repeat step 4 for r=1,2,3....num
step4: Repeat step 5 for c=1,2....r
                    Begin

        print "*"
                    End
step8: 
step9: go to next line
step10: r=r+1
        [end of loop step4]
step11: stop