saving . . . saved Return type has been deleted. Return type has been hidden .
Return type
Title
Question
<span style="color: rgb(0, 0, 0); font-family: sans-serif; font-size: 12.8px;">While doing function ising parameters, Pls tell what is the signifine of giving int as return type for main()? Can't we use void main()?</span>

C-and-Cpp Functions 07-08 min 10-20 sec 10-06-20, 10:34 a.m. Ayushi1319

Answers:

We can use void main() to indicate to the OS that it will not return value back. To be on the safer side, we write int main(), to indicate all has gone well by returning 0 (convention of the Operating System).
12-06-20, 6:53 p.m. nags
Tq so much sir/madam
13-06-20, 3:06 p.m. Ayushi1319

Login to add comment


#include<stdio.h>
void main() 
{
int n,square;
clrscr() ;
printf ("enter the value of n") ;
scanf("%d", &n) ;
square=n*n;
printf ("square=%d") ;
getch() ;
}

10-07-20, 11:35 a.m. 1921271242003
n=5
Square=25
10-07-20, 11:36 a.m. 1921271242003
n=5
Square=25
10-07-20, 11:36 a.m. 1921271242003

Login to add comment


#include<stdio.h>
int mun(int num)
{
int square=num*num;
}
int main()
{
int square;
square=mun(16);
printf("square is %d\n", square);
return 0;
}


10-07-20, 7:30 p.m. Sakshichoudhary
Output is as follow
square is 256
10-07-20, 7:31 p.m. Sakshichoudhary

Login to add comment



#include<iostream>
using namespace std;
int mun(int num)
{
int square=num*num;
}
int main()
{
int square;
square=mun(16);
cout<<"square is %d\n"<<square;
return 0;
}

10-07-20, 8:08 p.m. Sakshichoudhary
Output is as follows
square is 256
10-07-20, 8:08 p.m. Sakshichoudhary

Login to add comment


#include<stdio.h>
void main() 
{
int n,square;
clrscr() ;
printf ("enter the value of n") ;
scanf("%d", &n) ;
square=n*n;
printf ("square=%d") ;
getch() ;
}
  
   Output is as follows
    n= 9
    square=81
11-07-20, 12:46 p.m. Pranitakotalwar


//Assignment 4
// c program of square of number 

#include<stdio.h>
void main() 
{
int n, square ;
printf("enter the value of n \n");
scanf("%d", &n);
square=n*n;
printf("square=%d", square);
getch();

Output is as follows 
n=6
square=36

11-07-20, 4:04 p.m. Kirtana_maru


#include<stdio.h>
void main()
{
int n, square;
printf("enter the value of n \n");
scanf("%d", &n);
square=n*n;
printf("square=%d", square);
getch();
}

Output is as follows
n=4
square=16
11-07-20, 4:32 p.m. 1921271242105


#include<stdio.h>
void main ()
{
int n, square;
printf("enter the value of n \n");
sang("%d",&n);
square=n*n;
printf("square=%d",square);
getch ();
}

Output of this program will be
n=5
 square =25

11-07-20, 5:36 p.m. s19_more_sneha@mgmcen.ac.in


#include<studio.h>
void main()
{
  int n, square;
  printf("Enter the value of n");
  scand("%d",&n);
  square=n*n;
  printf("\n square=%d", square);
  getch();
}


*****Output*****
n=9
square=81
14-07-20, 6:12 p.m. RPD


#include<studio.h>
Void main()
{
int n,square;
Printf("Enter the value of n ");
Scanf("%d",&n);
Square=n*n;
Printf("\n square=%d", square);
getch();
}

Output of this program wii be
n=5
Square=25
15-07-20, 9:46 p.m. 1921271242121


Log-in to answer to this question.