Write a c program using for loop to print typical pattern if
number of rows is entered by keyboard.
ABCBA
AB BA
A A

Answer Posted / a.jayashree

#include<stdio.h>
#include<string.h>
main()
{
char a[5];
int i=0,j=0;
printf("enter the string");
scanf("%s",a);
printf("\n%s",a);
for(i=0;i<a[5];i++)
{
if(a[i]==a[2])
{
printf("\n\t");
}
else
{
printf("%s",a);
}
}
for(j=0;j<a[5];j++)
{
if(a[j]==a[1])
{
if(a[j]==a[2])
{
if(a[j]==a[3])
{
printf("\n\t\t\t");
}
else
{
printf("%s",a);
}
}
}
}
}

Is This Answer Correct ?    2 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of errors are there in c language? Explain

583


What is the argument of a function in c?

584


What is difference between %d and %i in c?

704


what is a constant pointer in C

689


Explain how can you check to see whether a symbol is defined?

671






Why c is called a mid level programming language?

616


Explain how can you be sure that a program follows the ansi c standard?

874


What are the __date__ and __time__ preprocessor commands?

584


How can I read data from data files with particular formats?

614


explain what is an endless loop?

619


What is a void pointer? When is a void pointer used?

641


Can you explain what keyboard debouncing is, and where and why we us it? please give some examples

1670


What is scanf () in c?

672


What is function what are the types of function?

572


Difference between malloc() and calloc() function?

665