^^^What is the meaning of typing main explicitly?Does it mean int main()?Also I omitted the ampersand and getch sign as you said,here is the updated code,I have shortened it to 3 students.......
...
Type: Posts; User: sameertelkar
^^^What is the meaning of typing main explicitly?Does it mean int main()?Also I omitted the ampersand and getch sign as you said,here is the updated code,I have shortened it to 3 students.......
...
oops,I was careless to add that meaningless % over there
@Amitesh,I changed the scanf of name to %s but still ain't getting output
@grumpy,can you please correct the code?I am a beginner to C and...
Code to accept the information of 5 students and display the information of first 3 students......
#include<stdio.h>
main()
{
struct stud
{
char name[20];
int rollno;
'a' is a pointer,so when I increment it,it points to the next element.Why is it meaningless?
Its a code to find the largest number of a 3X3 matrix.The logic seems to be right........
#include<stdio.h>
main()
{
int matrix[3][3],i,k,j,*a;
a=&matrix[0][0];
printf("Enter the...
Here
12819
Dear Jim,My original code did get compiled without errors but I am getting a wrong output,I tried your code and I got the same output,I think there is some problem with the compiler.
Edit-I also...
Oh,here are the values,2000,15000,40000,60000,10000.
@Elkvis,some of the commands you used are not in my syllabus yet.
Unable to get output of this program,add bonus to employee salaries
#include<stdio.h>
main()
{
int salary[5],i;
printf("Enter the salaries");
for(i=0;i<=4;i++)
{
Thanks,got the output,just had to use a pre-processor directive.
Hello codeplug,can you explain what is stdout?Is it a pre processor directive like stdio?
There are no error messages,I just cannot see the output screen.
main()
{
int i=3;
printf("value of i=%d",i);
printf("address of i=%u",&i);
printf("value of i=%d",*(&i));
}
I forgot to add printf statement,thanks sonjared.
main()
{
char ch;
printf("enter an alphabet");
scanf("%c",&ch);
printf("%d",ch);
if(ch>=65 && ch<=90)
main()
{
char ch;
printf("enter an alphabet");
scanf("%c",&ch);
if(ch>=65 && ch<=90)
return(ch);
else
return(ch+10);
}
Thank you Matticus,yes [j-1] does go outside the bounds and your suggestion is better.
Here is the better code.
#include<stdio.h>
main()
{
int lnum[5][5];
int i,j,lnsf=1;
...
Thank you Salem,after an hour of trying your suggestion,I finally got it.Here is the code.
#include<stdio.h>
main()
{
int lnum[5][5];
int i,j,lnsf;
for(i=0;i<=4;i++)
{
Salem,I am still unable to frame the logic,do I have to use strings or structures?
I made the code that stores and prints 5 row by 5 column values but I have no idea how find the largest number from them.What should I do to find the largest number?If I use if-else then it would be...
I think we have to mention '%d' for value or '%u' for address and depending on that it'll print.
Thank you.
I tried it and I got the value but in my Text book its written that it gives the address?May be a typo?
Does S[0] give the address of the 0th element of the array S or does it give the value?
I have already compiled it and ran it and I am getting the desired output.And the typo was when I copied it into this forum,it wasn't in the actual code.
My question remains unanswered.
oops,It was typo,actually its,
i=((year/100)%10);
So in that case i will be 988 but still it seems to print 'dcccc',how when i isn't 9?
Its a code to convert any given year into its Roman equivalent.
#include<stdio.h>
int roman(int year)
{
int i;
printf("The year %d is converted to Roman------->",year);