CODE BOX
Pages
Home
Data Types
Algorithms
Easy Find
Linux Commands
Thursday 10 September 2015
WAP to input a name and print the name in the following pattern
RAJA
RAJ
RA
R
Code ::
#include <stdio.h>
#include <string.h>
int main ()
{
char a[100];
int i,j;
printf("Enter a name: ");
gets(a);
for(i=strlen(a);i>=0;i--)
{
for(j=0;j<i;j++)
{
printf("%c",a[j]);
}
printf("\n");
}
return 0;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment