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 is the general form of a C program?
Explain how can you restore a redirected standard stream?
What is putchar() function?
How can I insert or delete a line (or record) in the middle of a file?
what is a constant pointer in C
program to convert a integer to string in c language'
sum of two integers values only other then integer it should print invalid input.
what is pointer
Example of friendly function in c++
Do pointers store the address of value or the actual value of a variable?
FIND THE OUTPUT IF THE INPUT IS 5 5.75 void main() { int i=1; float f=2.25; scanf("%d%f",&i,&f); printf("%d %f",,i,f); } ANSWER IS 5 AND 2.25 WHY?
When should we use pointers in a c program?