How to count a sum, when the numbers are read from stdin and
stored into a structure?
Answer / pavan_mustyala
/**********
First construct the structure with total count on numbers
to be added. Now these members are accessed via that
structure variables. In the below example, structure
contains 2 numbers only.
***********/
#include <stdio.h>
struct numbers
{
int num1;
int num2;
};
void main()
{
struct numbers mpk;
int result;
printf("Enter two numbers");
scanf("%d%d",&mpk.num1, &mpk.num2);
result = mpk.num1 + mpk.num2;
}
| Is This Answer Correct ? | 1 Yes | 0 No |
how to delete an element in an array
main() { char *str1="abcd"; char str2[]="abcd"; printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd")); }
To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']
why array index always strats wuth zero?
main() { char *p; p="Hello"; printf("%c\n",*&*p); }
main( ) { int a[ ] = {10,20,30,40,50},j,*p; for(j=0; j<5; j++) { printf(ā%dā ,*a); a++; } p = a; for(j=0; j<5; j++) { printf(ā%d ā ,*p); p++; } }
int a=1; printf("%d %d %d",a++,a++,a); need o/p in 'c' and what explanation too
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }
How to read a directory in a C program?
Write out a function that prints out all the permutations of a string. For example, abc would give you abc, acb, bac, bca, cab, cba. You can assume that all the characters will be unique.
5 Answers IITR, Microsoft, Nike,
what is oop?
main() { static char names[5][20]={"pascal","ada","cobol","fortran","perl"}; int i; char *t; t=names[3]; names[3]=names[4]; names[4]=t; for (i=0;i<=4;i++) printf("%s",names[i]); }