Question

In case of any queries,please comment. I would be very happy to assist all your queries.Please give a Thumps up if you like the answer.

The answer is Final value of c is 610

Program

#include<stdio.h>
int main()
{
int a=200;
int b=300;
int c=500;
if(a>400)
b+=10;
else
if(c>300)   b+=50;
else b+=20;   c+=10;
c+=100;
if(b>800)
c+=10;
a+=10;
printf("Final value of a is %d\n",a);
printf("Final value of b is %d\n",b);
printf("Final value of c is %d\n",c);
return 0;
}

Here c is initialized to 500.
First condition a>400 is checked. It is false. So else part works
Here the condition if(c>300) is checked.This condition is true. So the statement b+=50 is executed. Thus b=350
Next the statement c+=10; is executed. Thus c=510.
Next the statement c+=100; is executed. Thus c=610.
Then the condition if(b>800) is evaluated. It is false.So the statement a+=10; is evaluated. Thus a=210

Output

Final value of a is 210
Final value of b is 350
Final value of c is 610

Screenshot

answered by: ANURANJAN SARSAM

In case of any queries,please comment. I would be very happy to assist all your queries.Please give a Thumps up if you like the answer.

The answer is Final value of c is 610

Program

#include<stdio.h>
int main()
{
int a=200;
int b=300;
int c=500;
if(a>400)
b+=10;
else
if(c>300)   b+=50;
else b+=20;   c+=10;
c+=100;
if(b>800)
c+=10;
a+=10;
printf("Final value of a is %d\n",a);
printf("Final value of b is %d\n",b);
printf("Final value of c is %d\n",c);
return 0;
}

Here c is initialized to 500.
First condition a>400 is checked. It is false. So else part works
Here the condition if(c>300) is checked.This condition is true. So the statement b+=50 is executed. Thus b=350
Next the statement c+=10; is executed. Thus c=510.
Next the statement c+=100; is executed. Thus c=610.
Then the condition if(b>800) is evaluated. It is false.So the statement a+=10; is evaluated. Thus a=210

Output

Final value of a is 210
Final value of b is 350
Final value of c is 610

Screenshot

#### Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
• ### Combine two codes (code 1) to get names with(code 2) to get info: Code 1: #include<unistd.h>...

Combine two codes (code 1) to get names with(code 2) to get info: Code 1: #include<unistd.h> #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> #include<dirent.h> #include<stdio.h> #include<stdlib.h> void do_ls(char []); int main(int argc,char *argv[]) { if(argc == 1) do_ls("."); else while(--argc){ printf("%s:\n",*++argv); do_ls(*argv); } } void do_ls(char dirname[]) { DIR *dir_ptr; struct dirent *direntp; if((dir_ptr = opendir(dirname)) == NULL) fprintf(stderr,"ls1:cannot open %s\n",dirname); else { while((direntp = readdir(dir_ptr)) != NULL) printf("%s\n",direntp->d_name); closedir(dir_ptr); } } ____________________________ code 2: #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> void show_stat_info(char *,...

• ### include «stdio.h void displaymenu(void) printf(" printf" Enter Choicen") printf Set (a), Clear (c), Toggle (t)\n"): printf("...

include «stdio.h void displaymenu(void) printf(" printf" Enter Choicen") printf Set (a), Clear (c), Toggle (t)\n"): printf(" void printbinaryfunsigned char x) int main (int argc, char argvl) r mask atoi(argv[1): unsigned char maskatoi(argv[11): ensigned ahao data - ateilargvl21): char operation if argc 3 printf(" printf" n" printf("usage: %s FristArg SecondArgin", argle)); return;

• ### #include <stdio.h> int main(int argc, char *argv[]) { int i; for (i = argc - 1;...

#include <stdio.h> int main(int argc, char *argv[]) { int i; for (i = argc - 1; i > 0; i--) printf("%s ", argv[i]); printf("\n"); return 0; } can you explain this code in c and why use this function

• ### devmem2.c #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <signal.h> #include <fcntl.h> #include...

devmem2.c #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <signal.h> #include <fcntl.h> #include <ctype.h> #include <termios.h> #include <sys/types.h> #include <sys/mman.h>    #define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \ __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0) #define MAP_SIZE 4096UL #define MAP_MASK (MAP_SIZE - 1) int main(int argc, char **argv) { int fd; void *map_base = NULL, *virt_addr = NULL; unsigned long read_result, writeval; off_t target; int access_type = 'w';    if(argc...

• ### T/F C Language Questions. Answer the following true/false questions. You must correctly state WHY your answer...

T/F C Language Questions. Answer the following true/false questions. You must correctly state WHY your answer is true or false in order to receive credit. #include <stdio.h> #include <string.h> int run_through(int num, char **a) { int i; int check=0; for(i=0;i<num;i++) { printf("%s\n", *(a+i)); if(strcmp(*(a+i), "filename")==0) { check=1; } } return check; } char** find_filename(int n, char **b) { int i; int check=0; for(i=0;i<n;i++) { if(strcmp(*b, "filename")==0) { b++; break; } b++; } return b; } int main(int argc, char **argv)...

• ### PLease explain output of these two programs: 1. #include <stdio.h> typedef struct { char *name; int...

PLease explain output of these two programs: 1. #include <stdio.h> typedef struct { char *name; int x, y; int h, w; } box; typedef struct { unsigned int baud : 5; unsigned int div2 : 1; unsigned int use_external_clock : 1; } flags; int main(int argc, char** argv){ printf("The size of box is %d bytes\n", sizeof(box)); printf("The size of flags is %d bytes\n", sizeof(flags)); return 0; } 2. #include <stdio.h> #include <string.h> /* define simple structure */ struct { unsigned...

• ### OPERATING SYSTWM Question 31 What is the output of this C program? #include #include void main()...

OPERATING SYSTWM Question 31 What is the output of this C program? #include #include void main() int mptr, *cptr mptr = (int*)malloc(sizeof(int)); printf("%d", "mptr); cptr = (int)calloc(sizeof(int),1); printf("%d","cptr); garbage 0 000 O garbage segmentation fault Question 8 1 pts If this program "Hello" is run from the command line as "Hello 12 3" what is the output? (char '1'is ascii value 49. char '2' is ascii value 50 char'3' is ascii value 51): #include<stdio.h> int main (int argc, char*argv[]) int...

• ### Deleting multiples of a given integer from a linked list: #include <stdio.h> #include <stdlib.h> #include <assert.h>...

Deleting multiples of a given integer from a linked list: #include <stdio.h> #include <stdlib.h> #include <assert.h> #define MAX 10000 typedef struct node_tag { int v; // data struct node_tag * next; // A pointer to this type of struct } node; // Define a type. Easier to use. node * create_node(int v) { node * p = malloc(sizeof(node)); // Allocate memory assert(p != NULL); // you can be nicer // Set the value in the node. p->v = v; p->next...

• ### In C Set hasDigit to true if the 3-character passCode contains a digit. 1 #include «stdio.h>...

In C Set hasDigit to true if the 3-character passCode contains a digit. 1 #include «stdio.h> 2 #include«string.h> 3 #include «stdbool.h 4 #include<ctype.h> 6 int main(void) 7 bool hasDigit; 8 char passCode501; 10 11 12 hasDigit false; scanf("%s", &passcode); 13 Your solution goes here * 14 15 if (hasDigit) 16 printf("Has a digit.n 4 #include <ctype.h> 6 int main (void) 1 8 char passCode [50]; bool hasDigit; hasDigit- false; 10 11 scanf("%s",&passcode); 12 13 14 15 if (hasDigit) 16 17...

• ### What are the description of approach or technique used in this? #include <stdio.h> long charCount=0; long...

What are the description of approach or technique used in this? #include <stdio.h> long charCount=0; long digitCount=0; long lineCount=0; long wordCount=0; long digitFreq[10]; int c=0; int outOfWord=0; int state=0; int inWord=1; void printStats(); void totalWords(); void totalLines(); void digitFrequency(); int main(int argc,char **argv) { int i; for(i=0;i<10;i++) { digitFreq[i]=0; } state=outOfWord; c=getchar(); while((c !=EOF)) { charCount++; digitFrequency(c); totalLines(c); totalWords(c); c=getchar(); } printStats(); return 1; } void totalLines(int c) { if(c == '\n') { lineCount++; } } void digitFrequency(int c) {...