C program to add two numbers using structure

C program to add two numbers using structure

#include<stdio.h>
#include<conio.h>

struct sum
{
int a;
int b;
};

void main()
{
int sum1;
struct sum s;
clrscr();

printf(“Enter two numbers:”);
scanf(“%d%d”,&s.a,&s.b);

sum1=s.a+s.b;
printf(“nSum=%d”,sum1);
getch();
}

2 thoughts on “C program to add two numbers using structure

  1. Ranjan

    Sir program me kuchh galti hai.
    11th and 16th line me.
    In 11th line: sum s;
    In 16th line: print(“\n sum=%d”,sum1);

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.