1. Home >
  2. Apps >
  3. Groups >

What's the difference between these two codes?

Question asked by KUCHIMANCHI SIREESHA in #Programming on Jul 13, 2020
KUCHIMANCHI SIREESHA
KUCHIMANCHI SIREESHA · Jul 13, 2020
Rank E2 - BEGINNER

Code1:

       #include<stdio.h>

       int sum(int a,int b);

       void main()

       {

       int a,b,result;

       printf("\n enter two 

          numbers:");

       scanf("%d%d",&a,&b);

       result=sum(a,b);

       printf("\n the sum 

            is:%d", result);

       }

       int sum(int a,int b)

       {

       return a+b;

       }

      







 

        

Code2:

        #include<stdio.h>

        void main()

        {

        int a,b,c;

        printf("enter two 

            numbers:",a,b);

        scanf("%d%d",&a,&b);

        c=a+b;

        printf("sum of two 

              numbers is 

                 %d",c);

        getch();

        }

Posted in: #Programming

You must log-in or sign-up to reply to this post.

Click to Log-In or Sign-Up