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
How many types of errors are there in c language? Explain
What is the argument of a function in c?
What is difference between %d and %i in c?
what is a constant pointer in C
Explain how can you check to see whether a symbol is defined?
Why c is called a mid level programming language?
Explain how can you be sure that a program follows the ansi c standard?
What are the __date__ and __time__ preprocessor commands?
How can I read data from data files with particular formats?
explain what is an endless loop?
What is a void pointer? When is a void pointer used?
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
What is scanf () in c?
What is function what are the types of function?
Difference between malloc() and calloc() function?