SlideShare a Scribd company logo
1 of 5
Class task 4
1. Create a program that obtains two numbers from the
user and print the sum difference multiplication, division
and remainder of the two.
#include<stdio.h>
#include<conio.h>
main()
{
int a , b;
printf("enter two numbers n");
scanf("%d%d",&a,&b);
printf("sum %dn",a+b);
printf("multiply %dn",a*b);
printf("division %dn",a/b);
printf("difference %dn",a-b);
printf("reminder of two %dn",a%b);
getch();
}
2. Create a program that obtains user’s age in years and convert it into days
and hours. Your output screenshould be similar to the following:
#include<stdio.h>
#include<conio.h>
main()
{
int a;
int days=365;
int hours=24;
printf("please enter your age in years : n");
scanf("%d",&a);
printf("you are %d days old n",a*days);
printf("while you are %d hours old",a*days*hours);
getch();
}
3. Create a program to prepare your mark sheet. Take the following subject
marks as input and show individual percentage,totalmarks obtain and total
percentage.
#include<stdio.h>
#include<conio.h>
main()
{
printf("subject t marks obtain t total marks t percentage");
int a=70,b=100;
float c=(a*100)/100;
printf("nenglish t %d t t %d tt %.2f",a,b,c);
int d=65,e=100;
float f=(d*100)/100;
printf("nurdu tt %d t t %d tt %.2f",d,e,f);
int g=80,h=100;
float i=(g*100)/100;
printf("nislamiat t %d t t %d tt %.2f",g,h,i);
int sum=a+d+g;
int sum1=b+e+h;
float fl=((c+f+i)*100)/300;
printf("nntotal tt %d tt %d tt %.2f",sum,sum1,fl);
getch();
}
4. If a five-digit number is input through the keyboard, write a program to
calculate the sum of its digits. (Hint: Use the modular division operator‘%’)
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,d,e,f,g,h,i,j,k,l;
printf("enter a five digit number");
scanf("%d",&a);
b=a%10;
printf("first digit: %d n",b);
c=a/10;
d=c%10;
printf("second digit: %dn",d);
e=c/10;
f=e%10;
printf("third digit: %dn",f);
g=e/10;
h=g%10;
printf("fourth digit: %dn",h);
i=g/10;
j=i%10;
printf("fifth digit: %dn",j);
k=i/10;
l=b+d+f+h+j;
printf("sum of the digit :%d",l);
getch();
}

More Related Content

What's hot

How to create score table?
How to create score table?How to create score table?
How to create score table?S C
 
Math 133 – unit 2 individual project name/tutorialoutlet
Math 133 – unit 2 individual project name/tutorialoutletMath 133 – unit 2 individual project name/tutorialoutlet
Math 133 – unit 2 individual project name/tutorialoutletCleasbyz
 
MCQs(MULTIPLE CHOICE QUESTIONS) POINTERS C
MCQs(MULTIPLE CHOICE QUESTIONS) POINTERS CMCQs(MULTIPLE CHOICE QUESTIONS) POINTERS C
MCQs(MULTIPLE CHOICE QUESTIONS) POINTERS Ccodingprograms
 
C programming codes for the class assignment
C programming codes for the class assignmentC programming codes for the class assignment
C programming codes for the class assignmentZenith SVG
 

What's hot (7)

How to create score table?
How to create score table?How to create score table?
How to create score table?
 
Math 133 – unit 2 individual project name/tutorialoutlet
Math 133 – unit 2 individual project name/tutorialoutletMath 133 – unit 2 individual project name/tutorialoutlet
Math 133 – unit 2 individual project name/tutorialoutlet
 
MCQs(MULTIPLE CHOICE QUESTIONS) POINTERS C
MCQs(MULTIPLE CHOICE QUESTIONS) POINTERS CMCQs(MULTIPLE CHOICE QUESTIONS) POINTERS C
MCQs(MULTIPLE CHOICE QUESTIONS) POINTERS C
 
Introduction of VAE
Introduction of VAEIntroduction of VAE
Introduction of VAE
 
C programming codes for the class assignment
C programming codes for the class assignmentC programming codes for the class assignment
C programming codes for the class assignment
 
week-18x
week-18xweek-18x
week-18x
 
Pointers
PointersPointers
Pointers
 

Similar to Class task 4

C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHFC BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHFAbcdR5
 
How c program execute in c program
How c program execute in c program How c program execute in c program
How c program execute in c program Rumman Ansari
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentalsZaibi Gondal
 
Core programming in c
Core programming in cCore programming in c
Core programming in cRahul Pandit
 
programming for programs solving using C language
programming for  programs solving using C languageprogramming for  programs solving using C language
programming for programs solving using C languagesushma chinta
 
Test flawfinder. This program wont compile or run; thats not
 Test flawfinder.  This program wont compile or run; thats not Test flawfinder.  This program wont compile or run; thats not
Test flawfinder. This program wont compile or run; thats notMoseStaton39
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solutionAnimesh Chaturvedi
 
Graphic Design Lab File.docx
Graphic Design Lab File.docxGraphic Design Lab File.docx
Graphic Design Lab File.docxPayalJindal19
 

Similar to Class task 4 (20)

C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHFC BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
 
Arithmetic operator
Arithmetic operatorArithmetic operator
Arithmetic operator
 
How c program execute in c program
How c program execute in c program How c program execute in c program
How c program execute in c program
 
Programming in c
Programming in cProgramming in c
Programming in c
 
C programs
C programsC programs
C programs
 
comp2
comp2comp2
comp2
 
Muzzammilrashid
MuzzammilrashidMuzzammilrashid
Muzzammilrashid
 
C lab
C labC lab
C lab
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
 
Core programming in c
Core programming in cCore programming in c
Core programming in c
 
C coding#1
C   coding#1C   coding#1
C coding#1
 
programming for programs solving using C language
programming for  programs solving using C languageprogramming for  programs solving using C language
programming for programs solving using C language
 
Linux_C_LabBasics.ppt
Linux_C_LabBasics.pptLinux_C_LabBasics.ppt
Linux_C_LabBasics.ppt
 
C lab programs
C lab programsC lab programs
C lab programs
 
C lab programs
C lab programsC lab programs
C lab programs
 
Test flawfinder. This program wont compile or run; thats not
 Test flawfinder.  This program wont compile or run; thats not Test flawfinder.  This program wont compile or run; thats not
Test flawfinder. This program wont compile or run; thats not
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solution
 
Najmul
Najmul  Najmul
Najmul
 
C file
C fileC file
C file
 
Graphic Design Lab File.docx
Graphic Design Lab File.docxGraphic Design Lab File.docx
Graphic Design Lab File.docx
 

Recently uploaded

Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communicationskarancommunications
 
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurVIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurSuhani Kapoor
 
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 DelhiCall Girls in Delhi
 
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...Any kyc Account
 
Unlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdfUnlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdfOnline Income Engine
 
The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyThe Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyEthan lee
 
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
Tech Startup Growth Hacking 101  - Basics on Growth MarketingTech Startup Growth Hacking 101  - Basics on Growth Marketing
Tech Startup Growth Hacking 101 - Basics on Growth MarketingShawn Pang
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Neil Kimberley
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxAndy Lambert
 
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999Tina Ji
 
Event mailer assignment progress report .pdf
Event mailer assignment progress report .pdfEvent mailer assignment progress report .pdf
Event mailer assignment progress report .pdftbatkhuu1
 
Grateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfGrateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfPaul Menig
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMRavindra Nath Shukla
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdfRenandantas16
 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear RegressionRavindra Nath Shukla
 
Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Roland Driesen
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayNZSG
 
Keppel Ltd. 1Q 2024 Business Update Presentation Slides
Keppel Ltd. 1Q 2024 Business Update  Presentation SlidesKeppel Ltd. 1Q 2024 Business Update  Presentation Slides
Keppel Ltd. 1Q 2024 Business Update Presentation SlidesKeppelCorporation
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Roland Driesen
 

Recently uploaded (20)

Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communications
 
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurVIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
 
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
 
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
 
Unlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdfUnlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdf
 
The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyThe Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
 
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
Tech Startup Growth Hacking 101  - Basics on Growth MarketingTech Startup Growth Hacking 101  - Basics on Growth Marketing
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
 
Forklift Operations: Safety through Cartoons
Forklift Operations: Safety through CartoonsForklift Operations: Safety through Cartoons
Forklift Operations: Safety through Cartoons
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptx
 
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
 
Event mailer assignment progress report .pdf
Event mailer assignment progress report .pdfEvent mailer assignment progress report .pdf
Event mailer assignment progress report .pdf
 
Grateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfGrateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdf
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSM
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear Regression
 
Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 May
 
Keppel Ltd. 1Q 2024 Business Update Presentation Slides
Keppel Ltd. 1Q 2024 Business Update  Presentation SlidesKeppel Ltd. 1Q 2024 Business Update  Presentation Slides
Keppel Ltd. 1Q 2024 Business Update Presentation Slides
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...
 

Class task 4

  • 1. Class task 4 1. Create a program that obtains two numbers from the user and print the sum difference multiplication, division and remainder of the two. #include<stdio.h> #include<conio.h> main() { int a , b; printf("enter two numbers n"); scanf("%d%d",&a,&b); printf("sum %dn",a+b); printf("multiply %dn",a*b); printf("division %dn",a/b); printf("difference %dn",a-b); printf("reminder of two %dn",a%b); getch(); }
  • 2. 2. Create a program that obtains user’s age in years and convert it into days and hours. Your output screenshould be similar to the following: #include<stdio.h> #include<conio.h> main() { int a; int days=365; int hours=24; printf("please enter your age in years : n"); scanf("%d",&a); printf("you are %d days old n",a*days); printf("while you are %d hours old",a*days*hours); getch(); }
  • 3. 3. Create a program to prepare your mark sheet. Take the following subject marks as input and show individual percentage,totalmarks obtain and total percentage. #include<stdio.h> #include<conio.h> main() { printf("subject t marks obtain t total marks t percentage"); int a=70,b=100; float c=(a*100)/100; printf("nenglish t %d t t %d tt %.2f",a,b,c); int d=65,e=100; float f=(d*100)/100; printf("nurdu tt %d t t %d tt %.2f",d,e,f); int g=80,h=100; float i=(g*100)/100; printf("nislamiat t %d t t %d tt %.2f",g,h,i); int sum=a+d+g; int sum1=b+e+h; float fl=((c+f+i)*100)/300; printf("nntotal tt %d tt %d tt %.2f",sum,sum1,fl);
  • 4. getch(); } 4. If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits. (Hint: Use the modular division operator‘%’) #include<stdio.h> #include<conio.h> main() { int a,b,c,d,e,f,g,h,i,j,k,l; printf("enter a five digit number"); scanf("%d",&a); b=a%10; printf("first digit: %d n",b); c=a/10; d=c%10; printf("second digit: %dn",d); e=c/10; f=e%10; printf("third digit: %dn",f); g=e/10;
  • 5. h=g%10; printf("fourth digit: %dn",h); i=g/10; j=i%10; printf("fifth digit: %dn",j); k=i/10; l=b+d+f+h+j; printf("sum of the digit :%d",l); getch(); }