## C C++ program to find total percent and division

If statement और decision making statements के बारे में अधिक जानने के लिए देखें— If statements in C

Unconditional branching statements के बारे में अधिक जानकारी के लिए देखें— Break, Continue and Goto in C

### C program to find total percent and division

``````#include<stdio.h>
int main()
{
int s1,s2,s3,s4,s5,t;
float p;
printf("Enter marks of five subjects:\n");
scanf("%d%d%d%d%d",&s1,&s2,&s3,&s4,&s5);
t=s1+s2+s3+s4+s5;
p=t/5.0;
printf("Total    = %d\n",t);
printf("Percent  = %f\n",p);
if(p>=60)
printf("Division = First");
else if(p>=45)
printf("Division = Second");
else if(p>=33)
printf("Division = Third");
else
printf("Division = Fail");
return 0;
}``````

### C++ program to find total percent and division

``````#include<iostream>
using namespace std;
int main()
{
int s1,s2,s3,s4,s5,t;
float p;
cout<<"Enter marks of five subjects: "<<endl;
cin>>s1>>s2>>s3>>s4>>s5;
t=s1+s2+s3+s4+s5;
p=t/5.0;
cout<<"Total    = "<<t<<endl;
cout<<"Percent  = "<<p<<endl;
if(p>=60)
cout<<"Division = First";
else if(p>=45)
cout<<"Division = Second";
else if(p>=33)
cout<<"Division = Third";
else
cout<<"Division = Fail";
return 0;
}``````

### Output of C C++ program to find total percent and division

```Enter marks of five subjects:
40 50 60 70 81
Total     =  301
Percent   =  60.200001
Division  =  First```
```Enter marks of five subjects:
4 5 6 7 8
Total     =  30
Percent   =  6.000000
Division  =  Fail```

Share it to:

## Write a C C++ program to find greatest in three numbers

C के विभिन्न control statements को जानने के लिए देखें— Control statements in C

If statement और decision making statements के बारे में अधिक जानने के लिए देखें— If statements in C

### C program to find greatest in three numbers

``````#include<stdio.h>
int main()
{
int n1,n2,n3;
printf("Enter three numbers: ");
scanf("%d%d%d",&n1,&n2,&n3);
if(n1>n2)
{
if(n1>n3)
printf("Greatest number = %d",n1);
else
printf("Greatest number = %d",n3);
}
else
{
if(n2>n3)
printf("Greatest number = %d",n2);
else
printf("Greatest number = %d",n3);
}
return 0;
}``````

### C++ program to find greatest in three numbers

``````#include<iostream>
using namespace std;
int main()
{
int n1,n2,n3;
cout<<"Enter three numbers: ";
cin>>n1>>n2>>n3;
if(n1>n2)
{
if(n1>n3)
cout<<"Greatest number = "<<n1;
else
cout<<"Greatest number = "<<n3;
}
else
{
if(n2>n3)
cout<<"Greatest number = "<<n2;
else
cout<<"Greatest number = "<<n3;
}
return 0;
}``````

### Output of C C++ program to find greatest in three numbers

```Enter three numbers: 4 8 5
Greatest number = 8```
```Enter three numbers: 33 12 15
Greatest number = 33```
```Enter three numbers: 40 40 40
Greatest number = 40```

Share it to:

## Write a C C++ program to find grade from given percent

Looping और iterative statements के बारे में और अधिक जानने के लिए देखें— Looping statements in C

If statement और decision making statements के बारे में अधिक जानने के लिए देखें— If statements in C

### C program to find grade from given percent

``````#include<stdio.h>
int main()
{
float p;
printf("Enter percent: ");
scanf("%f",&p);
if(p>=90)
{
printf("A+");
}
else if(p>=80)
{
printf("A");
}
else if(p>=60)
{
printf("B");
}
else if(p>=40)
{
printf("C");
}
else
{
printf("D");
}
return 0;
}``````

### C++ program to find grade from given percent

``````#include<iostream>
using namespace std;
int main()
{
float p;
cout<<"Enter percent: ";
cin>>p;
if(p>=90)
{
cout<<"A+";
}
else if(p>=80)
{
cout<<"A";
}
else if(p>=60)
{
cout<<"B";
}
else if(p>=40)
{
cout<<"C";
}
else
{
cout<<"D";
}
return 0;
}``````

### Output of C C++ program to find grade from given percent

```Enter percent: 95
A+```
```Enter percent: 88
A```
```Enter percent: 62
B```
```Enter percent: 40
C```
```Enter percent: 25
D```

Share it to:

## Write a C C++ program to check leap year

C Language की विशेषताओं एवं शक्तियों को जानने के लिए देखें—Features and Powers of C

If statement और इसके विभिन्न प्रकारो को जानने के लिए देखें—If statements in C

### C program to check leap year

``````#include<stdio.h>
int main()
{
int y;
printf("Enter an year: ");
scanf("%d",&y);
if(y%4==0&&y%100!=0||y%400==0)
{
printf("Leap year");
}
else
{
printf("Not a leap year");
}
return 0;
}``````

### C++ program to check leap year

``````#include<iostream>
using namespace std;
int main()
{
int y;
cout<<"Enter an year: ";
cin>>y;
if(y%4==0&&y%100!=0||y%400==0)
{
cout<<"Leap year";
}
else
{
cout<<"Not a leap year";
}
return 0;
}``````

### Output of C C++ program to check leap year

```Enter a year: 2020
leap year```
```Enter a year: 2021
Not a leap year```

Share it to:

## Write a C C++ program to check odd or even number

C-Language के विभिन्न Control Statements या Programming Constructs को जानने के लिए देखें—Control statements in C

If statement और इसके विभिन्न प्रकारो को जानने के लिए देखें—If statements in C

### C program to check odd or even number

``````#include<stdio.h>
int main()
{
int n;
printf("Enter a number: ");
scanf("%d",&n);
if(n%2==0)
{
printf("Even number");
}
else
{
printf("Odd number");
}
return 0;
}``````

### C++ program to check odd or even number

``````#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter a number: ";
cin>>n;
if(n%2==0)
{
cout<<"Even number";
}
else
{
cout<<"Odd number";
}
return 0;
}``````

### Output of C C++ program to check odd or even number

```Enter a number: 5
Odd number```
```Enter a number: 72
Even number```

Share it to:

## Write a C C++ program to find greater in two numbers

C के विभिन्न control statements को जानने के लिए देखें— Control statements in C

If statement और decision making statements के बारे में अधिक जानने के लिए देखें— If statements in C

### C program to find greater in two numbers

``````#include<stdio.h>
int main()
{
int n1,n2;
printf("Enter two numbers : ");
scanf("%d%d",&n1,&n2);
if(n1>n2)
{
printf("Greater number = %d",n1);
}
else
{
printf("Greater number = %d",n2);
}
return 0;
}``````

### C++ program to find greater in two numbers

``````#include<iostream>
using namespace std;
int main()
{
int n1,n2;
cout<<"Enter two numbers : ";
cin>>n1>>n2;
if(n1>n2)
{
cout<<"Greater number = "<<n1;
}
else
{
cout<<"Greater number = "<<n2;
}
return 0;
}``````

### Output of C C++ program to find greater in two numbers

```Enter two numbers : 30 90
Greater number = 90```
```Enter two numbers : 45 22
Greater number = 45```
```Enter two numbers : 50 50
Greater number = 50```

Share it to:

## Write a C C++ program to find absolute value of number

C Language के बारे में अधिक जानने के लिए देखें—Brief Introduction of C

If statement और इसके विभिन्न प्रकारो को जानने के लिए देखें—If statements in C

### C program to find absolute value of number

``````#include<stdio.h>
int main()
{
int n;
printf("Enter a number: ");
scanf("%d",&n);
if(n<0)
{
n = -n;
}
printf("Absolute value = %d",n);
return 0;
}``````

### C++ program to find absolute value of number

``````#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter a number: ";
cin>>n;
if(n<0)
{
n = -n;
}
cout<<"Absolute value = "<<n;
return 0;
}``````

### Output of C C++ program to find absolute value of number

```Enter a number: -5
Absolute value = 5```
```Enter a number: 28
Absolute value = 28```

Share it to: