code of a program in c language that ask a number and print
its decremented and incremented number..
sample output:

input number : 3
321123



code of a program in c language that ask a number and print its decremented and incremented number..

Answer / kurt s

#include <stdio.h>

int main() {
int n, ncpy;

printf("Input number: ");
scanf("%d", &n);

ncpy = n;

while (ncpy > 0) printf("%d", ncpy--);
while (ncpy < n) printf("%d", ++ncpy);
printf("\n");

return 0;
}

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Code Interview Questions

How can u say that a given point is in a triangle? 1. with the co-ordinates of the 3 vertices specified. 2. with only the co-ordinates of the top vertex given.

1 Answers  


main() { static int var = 5; printf("%d ",var--); if(var) main(); }

1 Answers  


To reverse an entire text file into another text file.... get d file names in cmd line

0 Answers   Subex,


What is the main difference between STRUCTURE and UNION?

13 Answers   HCL,


Write a routine that prints out a 2-D array in spiral order

3 Answers   Microsoft,






why java is platform independent?

13 Answers   Wipro,


how to return a multiple value from a function?

2 Answers   Wipro,


main() { 41printf("%p",main); }8

1 Answers  


typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }

1 Answers  


Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable, but aac or bcd are unacceptable.

5 Answers   Amazon, Microsoft,


What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

1 Answers  


main( ) { int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}}; printf(ā€œ%u %u %u %d \nā€,a,*a,**a,***a); printf(ā€œ%u %u %u %d \nā€,a+1,*a+1,**a+1,***a+1); }

2 Answers  


Categories