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 |
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.
void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(ā%dā,k); }
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.
void main () { int x = 10; printf ("x = %d, y = %d", x,--x++); } a. 10, 10 b. 10, 9 c. 10, 11 d. none of the above
write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30
main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }
which function is used to clear the buffer stream on gcc? for example: I wrote following code on gcc #include<stdio.h> int main(void) { char ch; int a,b; printf("\nenter two numbers:\t"); scanf("%d%d",&a,&b); printf("enter number is %d and %d",a,b); printf("\nentercharacter:\t"); scanf("%c",&ch); printf("enter character is %c",ch); return 0; } in above progarm ch could not be scan. why?plz tell me solution.
void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); }
how to delete an element in an array
How will u find whether a linked list has a loop or not?
main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); } int i;
main() { int c = 5; printf("%d", main||c); } a. 1 b. 5 c. 0 d. none of the above