Sunday, November 1, 2020
Pubg Mobile New Update Idea
C program of 1 to n sum, average, even sum & average, odd sum & average
#include <stdio.h>
int main()
{
int i,n,even=0,odd=0,sum=0,counteven=0,countodd=0,countsum=0;
printf("Enter a number:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("%d\n",i);
sum+=i;
countsum++;
if(i%2==0)
{
even+=i;
counteven++;
}
else
{
odd+=i;
countodd++;
}
}
printf("Sum=%d\n",sum);
printf("Average=%d\n",sum/countsum);
printf("Even Sum=%d\n",even);
printf("Even Average=%d\n",even/counteven);
printf("Odd Sum=%d\n",odd);
printf("Odd Average=%d",odd/countodd);
return 0;
}
C program to find even numbers, sum, average in between 1 to 10 using for loop and if....else statement
#include <stdio.h>
int main()
{
int i,sum,count=0;
for(i=1;i<=10;i++)
{
if(i%2==0)
{
printf("%d\n",i);
sum+=i;
count++;
}
}
printf("Sum=%d\n",sum);
printf("Average=%d",sum/count);
return 0;
}
C program to display even numbers, sum and their average in between 1 to 10
#include <stdio.h>
int main()
{
int i,sum;
for(i=2;i<=10;i+=2)
{
printf("%d\n",i);
sum+=i;
}
printf("Sum=%d\n",sum);
printf("Average=%d",sum/5);
return 0;
}
Displaying numbers 1 to 10 by running the loop for 5 times only in C
#include <stdio.h>
int main()
{
int i;
for(i=1;i<=10;i+=2)
{
printf("%d%d",i,i+1);
}
return 0;
}
Running loop from 10 to 1 but displaying 1 to 10 in C
#include <stdio.h>
int main()
{
int i;
for(i=10;i>=1;i--)
{
printf("%d\t",11-i);
}
return 0;
}
C program for displaying the cube of 1 to 10 numbers
#include <stdio.h>
int main()
{
int i;
for(i=1;i<=10;i++)
{
printf("%d\t",i*i*i);
}
return 0;
}
C program for developing the given number multiplication number
#include <stdio.h>
int main()
{
int i,n;
printf("Enter a number:");
scanf("%d",&n);
for(i=1;i<=10;i++)
{
printf("%d x %d = %d\n",n,i,n*i);
}
return 0;
}
C program to display 1 to the given number in descending order
#include <stdio.h>
int main()
{
int i,n;
printf("Enter a number:");
scanf("%d",&n);
for(i=n;i>=1;i--)
{
printf("%d",i);
}
return 0;
}
C program of even numbers in between 1-10
First Method:
#include <stdio.h>
int main()
{
int i;
for(i=2;i<=10;i+=2)
{
printf("%d",i);
}
return 0;
}
C program to print 86 to 35 in descending order
#include <stdio.h>
int main()
{
int i;
for(i=86;i>=35;i--)
{
printf("%d",i);
}
return 0;
}
How to Fight Overthinking or Negative Thoughts?
How to Combat Overthinking or Negative Thoughts? 1. Don’t Fight Your Thoughts Trying to suppress or control negative thoughts often backfire...
-
The bar graphs depict the information about the houses that are owned and rented by the people during time period of 1918 to 2011 in Englan...
-
The bar graphs depict the information about the people going to eating at fast-food restaurants in the USA in 2003, 2006 and 2013. A compari...