0% found this document useful (0 votes)
5 views3 pages

C Programming Basics: Sum and Average

Uploaded by

shrirupdeshpande
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

C Programming Basics: Sum and Average

Uploaded by

shrirupdeshpande
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Q1

#include <stdio.h>

int main() {

printf("Hello");

return 0;

Q2

#include <stdio.h>

int main() {

int a=8.5;

int b=9.6;

int c;

c=a+b;

printf("c=%d",c);

return 0;

Q3

#include <stdio.h>

int main() {

float a=8.5;

float b=9.6;

float c;

c=a+b;

printf("c=%.2f",c);

return 0;
}

Q4

#include <stdio.h>

int main() {

int a=5;

int b=10;

int c;

c=a+b;

printf("The sum of %d and %d is %d", a,b,c);

return 0;

Q5

#include <stdio.h>

int main()

int a=90;

int b=98;

int c=95;

int d=92;

int e=93;

float total=a+b+c+d+e;

float percentage = total / 500 * 100;

printf("The total of all subjects is %f & percentage is %f", total, percentage);

return 0;

Q6
#include <stdio.h>

int main()

int a,b,c;

printf("Enter the number");

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

c=a+b;

printf("The sum is: %d",c);

return 0;

Q7

#include <stdio.h>

int main()

int a,b,c,d,e;

printf("Enter Your Marks");

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

float total=a+b+c+d+e;

float percentage=total/500*100;

printf("Total marks: %f and Percentage: %f",total,percentage);

return 0;

}S

You might also like