Problem Description
Kamachi decided to write one program in which she has to get one values using structure concept and another values using union concept, the result should add both values.Help to her to write code.
Input Method
Integer ranges from 1 to 999
Output Method
sum of valuesTest Case 1
Input (stdin)3 4
Expected Output7
Test Case 2
Input (stdin)5 6
Expected Output11
Program#include <stdio.h> struct sum { int a,b; }s; int main() { int c; scanf("%d %d",&s.a,&s.b); c=s.a+s.b; printf("%d",c); return 0; }
No comments:
Post a Comment
Note: only a member of this blog may post a comment.