Write a simple program using structure


Now here we are creating a simple program for structure Sum of two Number is structure.

#include<stdio.h> #include &lt;conio.h> struct Sum { int x , y ; }s1; //here s is the member of structure that’s helps for accessing these variable x , y void main ( ) { int s ; clrscr ( ) ; printf ( "Enter two number!" ) ; scanf (" %d %d ", &s1 . x, &s1 . y) ; s = s1 . x + s1. y ; printf ( "The sum of two number is %d" ,s ) ; getch ( ) ; }

Output:-

Enter two number! 10 10
The sum of two number is 20