Get the value for the number and power value from the user.
Then multiply the given number according to the given power value.
Example:
=======
Enter the base :2
Enter the power value :3
Then...
Type: Posts; User: kiruthika
Get the value for the number and power value from the user.
Then multiply the given number according to the given power value.
Example:
=======
Enter the base :2
Enter the power value :3
Then...
int main () {
char c[21];
int i=0;
while (scanf("%c",&c[i])!=EOF) {
printf("%c",c[i++]);
}
}
Remove the curly brace in udpserver.c in the following line.
} while (sizeof(currentTime) >= 0);
Remove the curly brace ('}') in the above line.
Then in the sendto function pass the...
What input you have given for the following,
Please select a store (1-3):
Here if you give the value which is not between 1-3 then it will give the error "Invalid option".
You use the %.2f format specifier in printf inside the switch cases instead of %.2d.
Your code,
printf("\nDel Mar Sales Tax: $%.2d\n", totaltax1);
Change it like the following.
...
Remove the single quotes in the switch case.
I have modified your program into the following.
Try with that.
#include <stdio.h>
#include <stdlib.h>
int main ()
Change your loop like the following.
Your code,
for (i = 0; i < 10000000; i++) {
intArray[100] = i;
}
Change it like the following.
Answer for your first question.
If you used fscanf() to read content from the file, then use like the following.
fscanf(fp,"%[^\n]",s);
If you want to get the number of scores in a file try the followings.
#include<stdio.h>
int main()
{
FILE *fp=popen("wc -l score.txt","r");
int n;
...
Nothing big problem here.
Actually you have closed the main() function before printf statement.
So correct that one.
It will work correctly.
Problem in your code
}
void specifies no arguments.
#include<stdio.h>
#include<stdlib.h>
static int i=1;
int main()
{
Use strcmp function to compare the strings.
And use the fgets statement inside a while loop.So that you can traverse the entire file content.
Try like this,
...
In your code,
char *nm;
char *addy;
int nLength, aLength;
int phone;
printf("\nEnter the Name: ");
I have copied your code and I executed like the followings.It worked correctly for me.
#include<stdio.h>
#include<malloc.h>
main()
{
double **u;
int N = 52;
Using file command also we can get the file type.
Example
#include<stdio.h>
int main(int argc,char *argv[])
{
system("file filetype.c");
system("file ."); //'.' (dot)...
I have executed your program.It worked correctly only.
I have received the following as a output of your program.
Output
--------
enter length : 2
period is 2.836
length is 2
I modified your program into the following.Try with that.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Visit the following link.
<math.h>
In the structure you have declared ,
char *aname[MAX_LEN]
It represents array of pointer.Whether you want this as a array of pointer or like the following.
char aname[MAX_LEN].
And in strcmp...
regex_t re;
char patt[]="-w[0-9]*";
char string[]="-w100";
int status;
regcomp(&re,patt,REG_EXTENDED);
status=regexec(&re,string,(size_t)0,NULL,0);
...
I am not able to understand your problem clearly with the given data.
In the following code,
found_match = 0; //For this ID just given - mark that it has no match
// How would it keep...
main()
{
char arr[]={1,2,3,4};
int number=(arr[3]-'0')-1;
printf("%d\n",number);
}
'0' will take the ASCII value of zero.
ASCII value of zero is 48.
Trace the SIGINT signal by writing the signal handler.
Example
--------
void sig_handler()
{
--- /*handling SIGINT*/
---
}
visit the following link for socket programming in c.
Programming in C
Visit this link for vi text editor tutorial.
https://engineering.purdue.edu/ECN/Support/KB/Docs/ViTextEditorTutorial
If you want to compare the values in reverse order it is better to use double linked list instead of
single linked list.
In double linked list we can have previous and next pointers.So using...