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

main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }

4 Answers   CSC,


write a c program to print magic square of order n when n>3 and n is odd?

1 Answers   HCL,


write a c program to Create employee record by taking details like name, employee id, address and phone number. While taking the phone number, take either landline or mobile number. Ensure that the phone numbers of the employee are unique. Also display all the details

2 Answers   TCS,


void main() { void *v; int integer=2; int *i=&integer; v=i; printf("%d",(int*)*v); }

1 Answers   Honeywell,


write a c program to Reverse a given string using string function and also without string function

1 Answers  


Cau u say the output....?

1 Answers  


union u { struct st { int i : 4; int j : 4; int k : 4; int l; }st; int i; }u; main() { u.i = 100; printf("%d, %d, %d",u.i, u.st.i, u.st.l); } a. 4, 4, 0 b. 0, 0, 0 c. 100, 4, 0 d. 40, 4, 0

1 Answers   HCL,


main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }

1 Answers  


write a program in c to merge two array

2 Answers  


Find the largest number in a binary tree

7 Answers   Infosys,


Printf can be implemented by using __________ list.

3 Answers  


#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }

1 Answers  


Categories