Saturday, 27 July 2013
C-Program To Find Product of Natural Numbers divisible By 3 Up to a Limit
C-Program To Find the Product Of CUBES of Natural Numbers UP to a Limit
C-Program To Find The Product Of Even Natural Numbers Ut To a Limit
C-Program To Find Product Of odd Natural Numbers Up to a Limit
C-Program To Find The PRODUCT of Natural Numbers Upto a Limit
C-Program To Find SUM of Natural Numbers Divisible by a Number Given By user Upto a Limit
C-Program To Find SUM of Natural Numbers Divisible By 3 Upto a Limit
C-Program To Find The SUM of CUBES of Natural Numbers Upto a Limit
C-Program To Find SUM of SQUARES of Natural Numbers Upto a Limit
C-Program To Find The SUM of EVEN Numbers Upto a Limit
C-Program To Find The SUM Of ODD Numbers Upto a Limit
C-Program To Find The Biggest Number Among n Numbers (Biggest in an Array)
C-Program To Find Biggest among Three numbers using Conditional Operator
#include<stdio.h>
main ()
{
int a,b,c,biggest;
printf("Enter the three Numbers\t");
scanf("%d%d%d",&a,&b,&c);
if((a==b)&&(b==c))
{
printf("You Entered The Identical Number %d",a);
exit(0);
}
biggest=(a>b?a:b);
biggest=(biggest>c?biggest:c);
printf("BIGGEST Number Among %d %d %d is %d",a,b,c,biggest);
}
main ()
{
int a,b,c,biggest;
printf("Enter the three Numbers\t");
scanf("%d%d%d",&a,&b,&c);
if((a==b)&&(b==c))
{
printf("You Entered The Identical Number %d",a);
exit(0);
}
biggest=(a>b?a:b);
biggest=(biggest>c?biggest:c);
printf("BIGGEST Number Among %d %d %d is %d",a,b,c,biggest);
}
![]() |
| output |
C-Program To Find The Biggest Number Among Three Numbers Using IF statement
#include<stdio.h>
main ()
{
int a,b,c,biggest;
printf("Enter the three Numbers\t");
scanf("%d%d%d",&a,&b,&c);
if((a==b)&&(b==c))
{
printf("You Entered The Same Element %d",a);
exit(0);
}
if(a>b)
biggest=a;
else
biggest=b;
if(biggest>c)
printf("BIGGEST Number Among %d %d %d is %d",a,b,c,biggest);
else
printf("BIGGEST Number Among %d %d %d is %d",a,b,c,c);
}
main ()
{
int a,b,c,biggest;
printf("Enter the three Numbers\t");
scanf("%d%d%d",&a,&b,&c);
if((a==b)&&(b==c))
{
printf("You Entered The Same Element %d",a);
exit(0);
}
if(a>b)
biggest=a;
else
biggest=b;
if(biggest>c)
printf("BIGGEST Number Among %d %d %d is %d",a,b,c,biggest);
else
printf("BIGGEST Number Among %d %d %d is %d",a,b,c,c);
}
![]() |
| output |
Wednesday, 24 July 2013
C-Program to Find AVERAGE of n Numbers (Average of Elements in an Array)
#include<stdio.h>
main ()
{
int a[50],i,n,sum=0;
float avg;
printf("Enter the no.of elements\t");
scanf("%d",&n);
printf("\nEnter the elements\t");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
avg=(float)sum/(float)n;
printf("Average of given %d elements in the array is %f",n,avg);
getch();
}
main ()
{
int a[50],i,n,sum=0;
float avg;
printf("Enter the no.of elements\t");
scanf("%d",&n);
printf("\nEnter the elements\t");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
avg=(float)sum/(float)n;
printf("Average of given %d elements in the array is %f",n,avg);
getch();
}
![]() |
| output |
C-Program to Find AVERAGE of Five Numbers
C-Program to SUM of Elements Stored in an Array
C-Program to SUM of Numbers Upto a Limit (SUM of Natural Numbers Upto a Limit)
catogory:
tags:
Concept Introduction :
Find the sum of Natural numbers upto a limit.
For example:
natural numbers are 1 2 3 4 5 6 7 8 9 10 .....etc
if input is 4, output is 1+2+3+4=10 and
if input is 7,output is 1+2+3+4+5+6+7=28
Below program helps you to find sum of natural numbers upto your choices
How to Implement :
First initialize a variable sum(just say) as zero to clear previous values in that variable.
Read more...
Implementation in C language :
#include<stdio.h>
main ()
{
int n,sum=0,i;
printf("Enter the limit\t");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
sum=sum+i;
}
printf("Sum of numbers upto %d is \t%d",n,sum);
}
![]() |
| output |
C-Program to SUM of Two Numbers
C-Program to Print a line or a Paragraph
Subscribe to:
Comments (Atom)





















