code of a program in c language that ask a number and print
its decremented and incremented number..
sample output:
input number : 3
321123
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 |
typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }
main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 b. 2, 100 c. 4, 100 d. 4, 4
18 Answers HCL, IBM, Infosys, LG Soft, Satyam,
Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?
#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }
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
main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }
#ifdef something int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }
Is this code legal? int *ptr; ptr = (int *) 0x400;
main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }
void main () { int x = 10; printf ("x = %d, y = %d", x,--x++); } a. 10, 10 b. 10, 9 c. 10, 11 d. none of the above
write a c program to Create a registration form application by taking the details like username, address, phone number, email along with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 5 users and display the details. In place of password display “****”. (Use Structures).
0 Answers CDAC, College School Exams Tests,
main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }