‘C’ program to accepts a character and integer n as parameter and displays the next 'n' characters.
C File =>
/* Write a function in ‘C’, which accepts a character and integer n as parameter and displays the next 'n' characters. */
#include<stdio.h>
int main()
{
int n,i;
char c;
// defining function
void disp_chars(char ch,int n)
{
for(i=1;i<=n;i++)
{
printf("%c\t",ch+1);
ch++;
}
}
printf("\n Enter character : ");
scanf("%c",&c);
printf("\n Enter value of n : ");
scanf("%d",&n);
printf("\n Next %d characters are :\n",n);
disp_chars(c,n);
return 0;
}
Comments
Post a Comment
Please do not enter any spam link in message.