15,551 Topics
| |
#include <stdio.h> #include <stdlib.h> int fact(int); int main() { int n,total=1,i; printf("enter the series limit: "); scanf("%d",&n); total=total+n; for(i=2;i<=n;i+=2) { total=total+(pow(n,i)\fact(i)); } printf("%d",total); return 0; } int fact(int c) { int j=1; int facto=1; for(j=1;j<=c;j++) { facto=facto*j; } return facto; } my output should be like this 1+n+n*n\2!+n*n*n*n\4! the error … | |
i just want to ask if you know a formula, or just VERY SIMPLE codes on how to compute days between two dates? i really don't have an idea on how to make it. thank you! | |
Being an experience programmer (fortran and assembly), I decided to modernize my resume and tackle c. In the process, I learned that like other programming languages, there were many 'versions' of c. Several course books I read use the conio.h header file. I was looking for a substitute for conio.h … | |
My understanding of the C language is that the same identifier cannot be reused. However, the code below compiles on GCC without complaints, even when using the "-Wall -pedantic" flags. Is there something that I am missing? Does the standard say anything about functions/macros having the same name as typedef'd … | |
How can i do scanf's in just one line? because example first i will input a number then i will press enter then the cursor will go to the next line. how can i maintain the cursor in just one line? thank you | |
int i; float *pf; pf = (float *)&i; *pf = 100.00; printf("\n %d", i); | |
i just wanna ask if can i format centered the outputs of turbo c? just like when you do in microsoft word. thank you! | |
please suggest me topics for mini project in c programming. | |
I am trying to pass a pointer to a 3D array to a function in which I want to access an array element using pointer arithmetic. Define the array: const unsigned char TS_list_string[2][2][3] = { "abc", "def", "ghi", "jkl", }; Define the function void process_ts(const unsigned char *T1) { unsigned … | |
I have an array with a lot of numbers. How can I create intervals from these numbers? | |
are these declaration same? const char *const s; char const *const s; | |
any one help me how can i do this plz plz guyz help me don't say do it by your self i could'nt understand thats why i am asking from you if i know then why i ask i don't know thats why i am asking friends plz help me...!! … | |
As usual I know I'm probably doing something stupid. I'm trying to write the program below but I seem to have handled my queue incorrectly. The problem could be in one of three places; the way i handle moving on to the next node, my addboard function or my printsol … | |
I would like to make a memory allocation: `(*matrix)[i]=(int*)malloc(sizeof(int)*sz);` But I have got an error message: Invalid operands to binary * What should be the problem? | |
if I write the following code.. float a =1.3; double b=1.3; if(a>b) printf("hii"); else printf("hello"); the o/p comes hii...but if I change the values to 1.7 the output comes hello...can any1 explain the reason????if precision is to be taken into account then everytime double should be greater.. | |
| actually , I am solving a problem: A list is there in which infinite numbers(approx 1 lakh) are there, and i am reading one by one. At any point of time, I am asked to return the kth(it is given initally) minimum element from the elements read so far. my … |
Hello Im posting this in C because Arena is highly influenced by C.... Im trying to open a file using fopen but I cant get it to work. Ive made the permissions on the file 777 (all) just in case but it doesnt work. Can someone please test that it … | |
Hello I want to run a command as sudo (to be especific open a file) but I dont want to run the entire program as sudo obviously. How do i do a fopen with sudo previlges? I dont mind hardcoding the password (eg, so it wont ask me for my … | |
whenever i try to run my program it always has this error "In function mainrift" "syntax error at the end input" can someone help me. void mainrift() { int days = 1, choice = 0, gil = 20000, debt = 50000; int depgil = 0, phoenixdown1 = 0, elixiressence1 = … | |
i am using strrev function and also included the header file string.h but i am getting the compile error **‘strrev’ was not declared in this scope**. what else is required? | |
Good day ma'am/sir, i just wanna ask how to add color in a just specific word? because i tried this one printf("You chose"); textcolor(RED); printf("RED"); but still the whole output is colored red. please help, THANKS! | |
This program displays decimal,hexadecimal & character equivalents int main(void) { int i = 0; for(i = 0; i < 255; i++) printf("Dec-%3d hex-%02x Char-%c\n", i, i, i); return 0; } | |
How can I find the differences between two matrix? I should find the diverse numbers. Thanks in advance for your help! | |
File program which gives output induntation code when we call that file actualy it was uninduntationed before | |
I have a little problem related to the white spaces in my program. Well, the actual program I'm trying to make is something else. so this program is just to check whether the text is properly broken or not. The problem I'm facing is, for the first word in my … | |
i have to read a verilog file in c ..how will be the code in general? | |
| main() { char s[19]; strcpy(s,"\0"); if(s==NULL) printf("daniweb\n"); else printf("nitin\n"); return 0; } Can anyone tell me what is expected o/p of this and why ? help! thanks in advance. |
| hello, this is code to generate fibo numbers in log n time. it is giving o/p as "0", i dn't know where is error. please help. #include<stdio.h> int (*(fibo)(int m[][2],int p))[2] { int r[2][2]={0,0,0,0},d[2][2]={0,0,0,0}; int (*l)[2]; int i,j,k; if(p==1) return m; l=fibo(m,p/2); for(i=0;i<2;i++) for(j=0;j<2;j++) { r[i][j]=*((*l+i)+j); } for(i=0;i<2;i++) for(j=0;j<2;j++) for(k=0;k<2;k++) … |
| Hello guys ! Hope you're doing well. I have faced a problem in declaring linked lists inside a linked list. I made a picture because it speaks more than 1000 words ![list1](/attachments/large/3/list1.JPG "list1") Here's my structure declaration: typedef struct author *link; struct author { char name[20]; link next; link down; … |
The End.