WAP to accept first name,middle name & last name of a
student display its initials?
Answers were Sorted based on User's Feedback
Answer / ankush
hiiii Chandan
your answer is wrong...
first you use print this is wrong....it's printf....
&we cant store string in array by using %c operator...
here we use %s to store a string or print a string...
Is This Answer Correct ? | 8 Yes | 1 No |
Answer / ankush
#include<stdio.h>
#include<conio.h>
void main()
{
char fnm[20],snm[10],lnm[10];
clrscr();
printf("Enter student First Name: ");
gets(fnm);
printf("Enter student Middle Name: ");
gets(snm);
printf("Enter student Last Name: ");
gets(lnm);
printf("\nThe Name is: ");
printf("%s %s %s",fnm,snm,lnm);
getch();
}
Is This Answer Correct ? | 12 Yes | 7 No |
Answer / chandan kumar r
#include<stdio.h>
#include<conio.h>
void main()
{
char fname[20],mname[20],lname[20];
clrscr();
print("Enter student First Name: ");
scanf("%c",fname);
print("Enter student Middle Name: ");
scanf("%c",mname);
print("Enter student Last Name: ");
scanf("%c",lname);
print("The Output of the Following is: \n");
printf("%c %c %c",fname[0],mname[0],lname[0]);
getch();
}
Is This Answer Correct ? | 20 Yes | 17 No |
Answer / ricky
hi chandan
this is the modification of ur ans
#include<stdio.h>
#include<conio.h>
void main()
{
char fname[20],mname[20],lname[20];
clrscr();
printf("Enter student First Name: ");
scanf("%s",fname);
printf("Enter student Middle Name: ");
scanf("%s",mname);
printf("Enter student Last Name: ");
scanf("%s",lname);
printf("The Output of the Following is: \n");
printf("%c %c %c",fname[0],mname[0],lname[0]);
getch();
}
Is This Answer Correct ? | 2 Yes | 5 No |
What do you mean by a local block?
What are multidimensional arrays?
1.Why do you call C is middle level language? 2.Why do you call C is userfriendly language.
What is the difference between union and structure in c?
Discuss the function of conditional operator, size of operator and comma operator with examples.
what are two categories of clint-server application development ?
Is the below things valid & where it will be stored in memory layout ? static const volatile int i; register struct { } ; static register;
What is a lvalue
what is dangling pointer?
what do you mean by enumeration constant?
what is the use of getch() function in C program.. difference b/w getch() and getche()??
29 Answers HCL, IBM, Infosys, TCS, Wipro,
What is structure in c definition?